I'm trying to build a client for a third party application that resides on the server and accepts SSL communication. i'm using this code:
tcpClient.Conne ct(m_IPAddress, m_Port)
Dim sslStream As New SslStream(tcpCl ient.GetStream, False, New Net.Security.Re moteCertificate ValidationCallb ack(AddressOf ValidateServerC ertificate))
sslStream.Authe nticateAsClient (m_IPAddress)
If sslStream.CanWr ite And sslStream.CanRe ad Then
Dim bytes(tcpClient .ReceiveBufferS ize) As Byte
Dim sendBytes As [Byte]() = Encoding.ASCII. GetBytes(XMLStr eam)
sslStream.ReadT imeout = m_Timeout * 1000
sslStream.Write (sendBytes, 0, sendBytes.Lengt h)
sslStream.Read( bytes, 0, CInt(tcpClient. ReceiveBufferSi ze))
SSLSend = Encoding.ASCII. GetString(bytes )
Else
If Not sslStream.CanRe ad Then
tcpClient.Close ()
SSLSend = "0"
Else
If Not sslStream.CanWr ite Then
tcpClient.Close ()
SSLSend = "0"
End If
End If
End If
On the authenticate as client, I get an exception: A call to SSPI failed, see inner exception. Is the code I have correct? Is this a server problem?
tcpClient.Conne ct(m_IPAddress, m_Port)
Dim sslStream As New SslStream(tcpCl ient.GetStream, False, New Net.Security.Re moteCertificate ValidationCallb ack(AddressOf ValidateServerC ertificate))
sslStream.Authe nticateAsClient (m_IPAddress)
If sslStream.CanWr ite And sslStream.CanRe ad Then
Dim bytes(tcpClient .ReceiveBufferS ize) As Byte
Dim sendBytes As [Byte]() = Encoding.ASCII. GetBytes(XMLStr eam)
sslStream.ReadT imeout = m_Timeout * 1000
sslStream.Write (sendBytes, 0, sendBytes.Lengt h)
sslStream.Read( bytes, 0, CInt(tcpClient. ReceiveBufferSi ze))
SSLSend = Encoding.ASCII. GetString(bytes )
Else
If Not sslStream.CanRe ad Then
tcpClient.Close ()
SSLSend = "0"
Else
If Not sslStream.CanWr ite Then
tcpClient.Close ()
SSLSend = "0"
End If
End If
End If
On the authenticate as client, I get an exception: A call to SSPI failed, see inner exception. Is the code I have correct? Is this a server problem?
Comment