Last post Oct 09, 2017 03:15 PM by jzero
Oct 09, 2017 02:31 PM|NewUser2017|LINK
I want to connect to third party API from my web application. They have given me a certificate file(.p12) and two .pem files.One with certificate information and one with private key.
The issue is when i try to connect to the API, it gives me an error saying 'Signature and/or certificate missing'. This is how I added the certificate to my http request.
HttpWebRequest request = new HttpWebRequest();
X509Certificate cert = new X509Certificate("<location>","<password>");
I want to know what is missing in here. And is there any other way to add certificate to web request.
Thanks in advance
Oct 09, 2017 03:15 PM|jzero|LINK
If I´m right you have set key storage flag, since you loading from file and not from windows certificate storage, try
X509Certificate cert = new X509Certificate("<location>", "<password>",X509KeyStorageFlags.MachineKeySet);
or use X509Certificate2
X509Certificate2 cert = new X509Certificate2("<location>", "<password>",X509KeyStorageFlags.MachineKeySet);