digitaldrew
Well-known member
- Joined
- Nov 10, 2012
- Messages
- 167
- Programming Experience
- Beginner
Hey everyone, I'm trying to connect with a service through their EPP server on port 700. The service required me to go out and purchase a certificate. They told me I then had to upload the "public" certificate into my user account (which I did) and then pass the "private" key when making a request to the service. They also claim users tend to pass the public and private keys underneath each other when making a request..
I'm guessing they are basically taking my private key and comparing it to my public key as an added layer of security? Anyways, I've gone out and tried doing as they said - I took the public key and placed it under the private key and then named the file "FIcert.crt".. It contains nothing other than the two keys inside. I've then tried implementing it into my code:
However, I get an error right away on this line:
The error is:
System.Security.Cryptography.CryptographicException: 'Cannot find the requested object.
I'm certain the path to the certificate is correct. So, I wonder what other kind of issue this could be related to? Any help or suggestions would be greatly appreciated!
I'm guessing they are basically taking my private key and comparing it to my public key as an added layer of security? Anyways, I've gone out and tried doing as they said - I took the public key and placed it under the private key and then named the file "FIcert.crt".. It contains nothing other than the two keys inside. I've then tried implementing it into my code:
VB.NET:
Dim sslCertificate As X509Certificate2 = New X509Certificate2("C:\Test\FIcert.crt")
Dim client As New TcpClient(DRShost, 700)
Dim sslStream As New Security.SslStream(client.GetStream(), False, New RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate), Nothing)
sslStream.AuthenticateAsClient(sslCertificate.ToString)
VB.NET:
Public Shared Function ValidateServerCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
If sslPolicyErrors = SslPolicyErrors.None Then Return True
MsgBox("Certificate error: {0}", sslPolicyErrors)
Return False
End Function
However, I get an error right away on this line:
VB.NET:
Dim sslCertificate As X509Certificate2 = New X509Certificate2("C:\Test\FIcert.crt")
The error is:
System.Security.Cryptography.CryptographicException: 'Cannot find the requested object.
I'm certain the path to the certificate is correct. So, I wonder what other kind of issue this could be related to? Any help or suggestions would be greatly appreciated!