Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hello experts,
I am developing a client server application using SSL in vb.net. I followed the example here: http://msdn.microsoft.com/en-us/library/system.net.security.sslstream(v=vs.80).aspx to get it setup. I created a certificate file by extracting it from the .jks filw i created using java keytool, so it is self-signed. In my work, i used Mozilla Firefox browser as the client and my app is acting as the server. Whenever i load a page with "https://" prefix in mozilla firefox, it connects to my app and my app will show an unhandled exception saying: "The handshake failed due to an unexpected packet
format." on the line
 
"sStream.AuthenticateAsServer(cert, False, SslProtocols.Tls, True)"
 
I am totally confused. I dont know what to do again.
Here is my code:
 
'.....importing the necessary namespaces
Dim s As TcpListener = New TcpListener(IPAddress.Any, 8081)
s.Start()
Dim cert As X509Certificate = X509Certificate.CreateFromCertFile("mycert.cer")
Dim cs As TcpClient = s.AcceptTcpClient()
Dim sStream As New sslStream(cs.GetStream(), False)
 
sStream.AuthenticateAsServer(cert, False, SslProtocols.Tls, True)'this is where i got the error

'read message from client.......
'the rest of the code goes here
 
Pls help me
Posted 14-Dec-12 10:40am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 723
1 George Jonsson 370
2 BillWoodruff 277
3 Garth J Lancaster 250
4 Sergey Alexandrovich Kryukov 249
0 Sergey Alexandrovich Kryukov 10,764
1 Maciej Los 5,474
2 OriginalGriff 5,472
3 CPallini 3,819
4 BillWoodruff 3,594


Advertise | Privacy | Mobile
Web01 | 2.8.141030.1 | Last Updated 14 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100