Is there a way to set TCP options using the sockets API?

I'm a bit confused by your question. You can certainly set socket options on a socket using the setsockopt function, but by the sound of the rest of your question, this isn't quite what you mean. I've never heard of any transport protocol called Authenticated TCP and google throws up nothing useful.Is it a standard; is there an RFC?

I'm a bit confused by your question. You can certainly set socket options on a socket using the setsockopt function, but by the sound of the rest of your question, this isn't quite what you mean. I've never heard of any transport protocol called Authenticated TCP and google throws up nothing useful.Is it a standard; is there an RFC?

If you're just wanting a secure, authenticated TCP transport layer, then you should look in to Secure Sockets Layer, or SSL for short, or its replacement, Transport Layer Security, or TLS for short. There will almost certainly be an implementation for whatever language you're using (you haven't specified). For C/C++, there's: OpenSSL For .

Net, there's: SslStream For Java, there's the Secure Socket Extensions Also, what do you mean by MD5 for authentication? MD5 is a hashing algorithm, however it's not collision resistant enough for use in communication that requires secure signatures. Edit aha!

You're talking about TCP options, I understand now. I haven't seen any implementations of that particular TCP option built in to any of the socket APIs, so you may be out of luck here.It depends on the implementation you use, but it might be especially rare given that this is a fairly obscure TCP option designed for enhancing the border gateway protocol, not something you would usually have use for outside of routing software. In case it is supported, you would set it something like this: BOOL optVal = TRUE; int optLen = sizeof(BOOL); if (setsockopt( socket, IPPROTO_TCP, TCP_WHATEVER, optVal, optLen)!

= SOCKET_ERROR) { printf("Success\n"); }.

Thanks IRBMe! I am referring to RFC 2385. To make a long story short and based on the nature of the application, we have to use TCP with MD5 option as the transport (C implementation).

I see sockets API as one possible option to setup this kind of a transport. I was wondering if there exist some other API set that could do the same thing but at the same time simplify the implementation a bit. Thanks!

– Iceman Jul 16 '09 at 18:03.

If you are looking for the TCP-MD5 option described by RFC 2385, a few systems support a TCP_MD5SIG option to enable this. It is enabled on a socket as follows: int opt = 1; setsockopt(sockfd, IPPROTO_TCP, TCP_MD5SIG, &opt, sizeof(opt)); See tcp(7) for further details.

I just implemented a TCP-MD5 connection class in Ruby, and thought this code snippet might save anyone else the effort (at least anyone who is doing it on Linux, where the facility is undocumented). This was just from looking at headers and experimenting; hopefully the Ruby isn't too scary for people writing in other languages. Class TCPMD5Socket TCP_MD5SIG_MAXKEYLEN family = Socket.

Const_get(IPAddr.new(host). Ipv4? "AF_INET" : "AF_INET6") super(family, Socket::SOCK_STREAM, 0) # struct tcp_md5sig { # struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ # __u16 __tcpm_pad1; /* zero */ # __u16 tcpm_keylen; /* key length */ # __u32 __tcpm_pad2; /* zero */ # __u8 tcpm_keyTCP_MD5SIG_MAXKEYLEN; /* key (binary) */ # }; tcp_md5sig_buffer = Socket.

Pack_sockaddr_in(port, host), 0, password. Length, 0, password . Pack("a128SSLa#{TCP_MD5SIG_MAXKEYLEN}") setsockopt(IPPROTO_TCP, TCP_MD5SIG, tcp_md5sig_buffer) connect(Socket.

Pack_sockaddr_in(port, host)) end end This won't work on anything but Linux 2.6.20 onwards, but at least if you're on FreeBSD instead, it's described in a man page.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions