Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am trying to send 4 certificates while making a web service call using the but keep getting the error The request was aborted: Could not create SSL/TLS secure channel.
VB
Dim req As HttpWebRequest = HttpWebRequest.CreateDefault(New System.Uri(cred.endpoint))
Dim root As X509Certificate2 = New X509Certificate2()
Dim policy As X509Certificate2 = New X509Certificate2()
Dim issue As X509Certificate2 = New X509Certificate2()
Dim certv As X509Certificate2 = New X509Certificate2()

Dim rootStore As New X509Store(StoreName.Root, StoreLocation.LocalMachine)
rootStore.Open(OpenFlags.ReadOnly)
root = rootStore.Certificates.Find(X509FindType.FindByIssuerName, "ROOT-CA", True)(0)
Dim intmStore As New X509Store(StoreName.CertificateAuthority, StoreLocation.LocalMachine)
intmStore.Open(OpenFlags.ReadOnly)
policy = intmStore.Certificates.Find(X509FindType.FindByIssuerName, "ROOT-CA", True)(0)
issue = intmStore.Certificates.Find(X509FindType.FindByIssuerName, "POLICY-CA", True)(0)
certv = intmStore.Certificates.Find(X509FindType.FindByIssuerName, "ISSUECA05-CA", True)(0)
req.ClientCertificates.Add(root)
req.ClientCertificates.Add(policy)
req.ClientCertificates.Add(issue)
req.ClientCertificates.Add(certv)
req.Headers.Add("SOAP:Action")
req.ContentType = "text/xml; charset=utf-8"
req.Accept = "text/xml"
req.Method = "POST"
ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
ServicePointManager.ServerCertificateValidationCallback = AddressOf AcceptAllCertifications
Dim soapXML As New System.Xml.XmlDocument
soapXML.LoadXml(txn)
Dim strm As Stream = req.GetRequestStream()
soapXML.Save(strm)

Dim resp = req.GetResponse()
Dim stread As StreamReader = New StreamReader(resp.GetResponseStream())
Dim st As String = stread.ReadToEnd()


When I check the trace logs from wireshark i notice that the certificate length is 0. Does that mean am not sending the certificate?
Posted
Updated 26-Mar-15 5:01am
v3
Comments
ZurdoDev 26-Mar-15 11:09am    
Why are you attaching 4 certificates? I did this type of thing years ago and I only needed the one certificate. Are you sure you need all 4?
llyno 26-Mar-15 11:11am    
Yes the webservice requires that I send all the four certificates.
Sergey Alexandrovich Kryukov 26-Mar-15 11:28am    
Will you debug it and see what happens after 4the req.ClientCertificates.Add.
Also, don't trace logs, debug. You can create a simple console application for debugging purposes.
—SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900