SSL/TLS is not working with .p7b certificate -


i generated client certificate payment provider , have use in request theirs https api. code looks like:

httpwebrequest request = (httpwebrequest)webrequest.create("https://site/api/requests/");  request.method = "post"; request.contenttype = "application/json"; request.contentlength = encoding.utf8.getbytecount(postdataserialized); request.keepalive = false;  request.protocolversion = httpversion.version10;  servicepointmanager.expect100continue = false; servicepointmanager.securityprotocol = securityprotocoltype.tls11; servicepointmanager.servercertificatevalidationcallback = delegate { return true; };  x509certificate2collection certcollection = new x509certificate2collection(); certcollection.import(@"d:\production merchant certificate.p7b");  request.clientcertificates.addrange(certcollection); request.preauthenticate = true;   using (streamwriter os = new streamwriter(request.getrequeststream())) //exception { } 

and 2 errors:

error occured while sending post (form) request underlying connection closed: unexpected error occurred on send. system.io.ioexception: unable read data transport connection: existing connection forcibly closed remote host. ---> system.net.sockets.socketexception: existing connection forcibly closed remote host.

and

the request aborted: not create ssl/tls secure channel.

i grateful if tell me proper way send request chain of certificates.

in microsoft management console have added p7b personal , intermediate certification authorities local computer, , still these 2 errors.

the problem client certificates not contain private key @ all. pkcs#7 container (with .p7b file extension) not supposed store certificates private keys. need certificate object valid reference private key. certificate may installed in personal certificate store (currentuser\my), or importing pkcs#12 (with .pfx or .p12 file extension) container supposed store certificates private keys.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -