Last post May 31, 2014 09:48 AM by rune007
May 23, 2014 09:06 AM|rune007|LINK
Hi we are trying to make a GET request against a REST API of a partner company.
In collaboration with the partner company we have produced the necessary ingredients, but we don't know how to put them together?
This is what we have:
- URL: The URL of the partner REST API
- PRIVATE KEY: privateKey.key
- CERTIFICATE: certificate.pem
- PASSWORD: We have defined some passwords.
We have tried to open the .key and the .pem files with Notepad, and the text there is readable, and goes like:
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
We are wondering how to make a REST request with these things in C#?
We have been wondering if the PRIVATE KEY and the CERTIFICATE should be converted into another file?
So with OpenSSL, running the command below, we tried to convert those two files into a .pfx file:
openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt
The resulting .pfx file was not human readable.
To make the REST GET request is it then necessary to install the certificate?
As you may understand from this post we are quite ignorant on the subject of making a request with certificate, private key and password in C#, looking for some help.
There are many questions and we actually don't know exactly what to do.
May 26, 2014 06:50 AM|Fuxiang Zhang - MSFT|LINK
Thanks for your post.
According to your description, I see you want to call the wcf rest service with client certificate.
For this issue, we should install the certificate in the client side, with the private key, we should install the .pfx file.
I suggest you refer to below article "call a Web service by using a client certificate for authentication". I think you can use same principle in rest service.
And use client certificate not in certificate store, see below.
Hope that helps, thanks.
May 31, 2014 09:48 AM|rune007|LINK
Thank you for your nice reply Fuxiang Zhang :)
I have described how we solved the problem on this thread: