EmbeddedRelated.com
Forums
Memfault Beyond the Launch

How to use TLS/SSL certificate in Active Open

Started by "dyn...@ymail.com" March 5, 2013
I connect rcm5600w(as client/active-open) to computer(as server/passive-open) using sslstream socket(http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx).

How to perform the handshake SslStream implements the AuthenticateAsServer() and AuthenticateAsClient() in rcm5600w?

#class auto
#define TCPCONFIG 1
#use "dcrtcp.lib"
#define DEST "192.168.1.1" // ip server (computer)
#define PORT 8080 // socket port server (computer)

void main()
{
char buffer[100];
int bytes_read;
longword destIP;
tcp_Socket socket;

// Start network and wait for interface to come up
sock_init_or_exit(1);

// open socket
tcp_open(&socket,0,DEST,PORT,NULL);

printf("Waiting for connection...\n");
while(!sock_established(&socket)
&& sock_bytesready(&socket)==-1)
{
tcp_tick(NULL);
}
printf("Connection established\n");
}

After reading the manual (TN245.pdf) like this:
---------------------------
"Some Rabbit-based applications may require that the device initiate a connection to a server (with the Rabbit acting as a client), rather than the other way around (with the Rabbit acting as a server).
The current Rabbit implementation of SSL does not support client-side SSL, so some applications will simply not be possible."
---------------------------

My question: What a new Dynamic C support for used SSL in client? I'm used Dynamic C 10.54 with rcm5600w. Thank you.

--- In r..., "dynamic_c@..." wrote:
>
> I connect rcm5600w(as client/active-open) to computer(as server/passive-open) using sslstream socket(http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx).
>
> How to perform the handshake SslStream implements the AuthenticateAsServer() and AuthenticateAsClient() in rcm5600w?
>
> #class auto
> #define TCPCONFIG 1
> #use "dcrtcp.lib"
> #define DEST "192.168.1.1" // ip server (computer)
> #define PORT 8080 // socket port server (computer)
>
> void main()
> {
> char buffer[100];
> int bytes_read;
> longword destIP;
> tcp_Socket socket;
>
> // Start network and wait for interface to come up
> sock_init_or_exit(1);
>
> // open socket
> tcp_open(&socket,0,DEST,PORT,NULL);
>
> printf("Waiting for connection...\n");
> while(!sock_established(&socket)
> && sock_bytesready(&socket)==-1)
> {
> tcp_tick(NULL);
> }
> printf("Connection established\n");
> }
>

I think newer versions (>10.60?) include support in the HTTP client library for making outbound HTTPS connections.

Try downloading 10.72, and look at Samples/tcpip/http/https_client.c and https_client_nb.c.

-Tom
On Mar 7, 2013, at 2:51 PM, d...@ymail.com wrote:

> After reading the manual (TN245.pdf) like this:
> ---------------------------
> "Some Rabbit-based applications may require that the device initiate a connection to a server (with the Rabbit acting as a client), rather than the other way around (with the Rabbit acting as a server).
> The current Rabbit implementation of SSL does not support client-side SSL, so some applications will simply not be possible."
> ---------------------------
>
> My question: What a new Dynamic C support for used SSL in client? I'm used Dynamic C 10.54 with rcm5600w. Thank you.
>
@tom, Thank you for point out.

Is possible to perform the handshake SslStream implements the AuthenticateAsClient use API (NOT THROUGH HTTPS)?

I read on tcp/ip user manual volume 3 as follows, I still tried and not succeeded. Any suggestion? Thanks

tcp_extopen(&tcp_sock, )
sock = &tcp_sock; // mention of 'sock' refers to plaintext TCP socket
while (!sock_established(sock)) tcp_tick(NULL);
// OK, socket is established. Can use plaintext communication
sock_write(sock, "Please start your TLS negotiations!", );
sock_secure(&tcp_sock, &tls_sock, );
sock = tls_sock; // now, mention of 'sock' refers to encrypted connection!
sock_write(sock, "Password: highlySecret",)
sock_gets(sock, response, )
// OK, let's close down
sock_unsecure(tls_sock);
sock_close(&tcp_sock);
--- In r..., Tom Collins wrote:
>
> I think newer versions (>10.60?) include support in the HTTP client library for making outbound HTTPS connections.
>
> Try downloading 10.72, and look at Samples/tcpip/http/https_client.c and https_client_nb.c.
>
> -Tom
>
>
> On Mar 7, 2013, at 2:51 PM, dynamic_c@... wrote:
>
> > After reading the manual (TN245.pdf) like this:
> > ---------------------------
> > "Some Rabbit-based applications may require that the device initiate a connection to a server (with the Rabbit acting as a client), rather than the other way around (with the Rabbit acting as a server).
> > The current Rabbit implementation of SSL does not support client-side SSL, so some applications will simply not be possible."
> > ---------------------------
> >
> > My question: What a new Dynamic C support for used SSL in client? I'm used Dynamic C 10.54 with rcm5600w. Thank you.
> >
> >
>

If you're looking for how to establish TLS, look at the SMTP samples. I seem to recall that there is one for making a TLS connection to a Gmail SMTP server. There should be documentation for secure sockets to go with that version of Dynamic C. Sorry, but I don't have a link handy.

-Tom
(Sent from my phone; forgive my brevity.)

On Mar 8, 2013, at 7:31 PM, "d...@ymail.com" wrote:

> @tom, Thank you for point out.
>
> Is possible to perform the handshake SslStream implements the AuthenticateAsClient use API (NOT THROUGH HTTPS)?
>
> I read on tcp/ip user manual volume 3 as follows, I still tried and not succeeded. Any suggestion? Thanks
>
> tcp_extopen(&tcp_sock, …)
> sock = &tcp_sock; // mention of 'sock' refers to plaintext TCP socket
> while (!sock_established(sock)) tcp_tick(NULL);
> // OK, socket is established. Can use plaintext communication…
> sock_write(sock, "Please start your TLS negotiations!", …);
> sock_secure(&tcp_sock, &tls_sock, …);
> sock = tls_sock; // now, mention of 'sock' refers to encrypted connection!
> sock_write(sock, "Password: highlySecret",…)
> sock_gets(sock, response, …)
> // OK, let's close down
> sock_unsecure(tls_sock);
> sock_close(&tcp_sock);
>
> --- In r..., Tom Collins wrote:
> >
> > I think newer versions (>10.60?) include support in the HTTP client library for making outbound HTTPS connections.
> >
> > Try downloading 10.72, and look at Samples/tcpip/http/https_client.c and https_client_nb.c.
> >
> > -Tom
> >
> >
> > On Mar 7, 2013, at 2:51 PM, dynamic_c@... wrote:
> >
> > > After reading the manual (TN245.pdf) like this:
> > > ---------------------------
> > > "Some Rabbit-based applications may require that the device initiate a connection to a server (with the Rabbit acting as a client), rather than the other way around (with the Rabbit acting as a server).
> > > The current Rabbit implementation of SSL does not support client-side SSL, so some applications will simply not be possible."
> > > ---------------------------
> > >
> > > My question: What a new Dynamic C support for used SSL in client? I'm used Dynamic C 10.54 with rcm5600w. Thank you.
> > >
> > >
> > >
> >

Memfault Beyond the Launch