I'm trying to make a web request to a site I wrote which requires the client to provide certificates to authenticate.
Specifically, I'm trying to write a C# (or Visual C++) application that can make a web request, but use the certificate and private key on my HSM.
I realize there's one similar question here, but it hasn't received the answer I need.
I can already:
- P/Invoke my native pkcs#11 library (a DLL), login, find/create objects on the HSM
- Using the pkcs#11 interface I can read find the X509 certificate on the HSM
I cannot:
- Export the Private Key from the HSM. It is not exportable.
So what I need is a way to make a Web Request from my application and say, "For the handshake, use the X509 and Private Key objects on my HSM."
Please don't suggest that I "check out" things like NCryptoki, Bouncy Castle, etc- I can already use them to make my Windows app. communicate with the HSM. What I need is how I can I make the Windows app. make a web request under the context of the credentials on the HSM.