locked
How to make a REST request with certificate, private key and password in C#? RRS feed

  • Question

  • User-589702765 posted

    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:

    privateKey.key:
    -----BEGIN PRIVATE KEY-----
    MIIEvAIBA
    (...)
    6xz6tGWWdkR4uw==
    -----END PRIVATE KEY-----

    certificate.pem
    -----BEGIN CERTIFICATE-----
    MIIEbDCCA (...)
    QmliDutXh/BjT0=
    -----END CERTIFICATE-----

    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.

    Friday, May 23, 2014 9:06 AM

Answers

All replies