How to work with X509Certificate2 and pfx file?

1.2k views Asked by At

I have a web application that needs a physical address of pfx file and use it for signing/encrypting data and everything works fine.

I want to upload the code on Azure app service with the least changes in the code. How do I do it? can I specify the pfx path somehow instead of physical address?

What shall I do?

I've found other sources like this: Use client certificate from Azure Website instance

But all of them rely on uploading the certificate into Azure.

More info

In my code I am using this override of X509Certificate2:

 X509Certificate2(string filename)

Which works perfectly fine with a physical address like

C:\myfile.pfx
==>  X509Certificate2("myfile.pfx")

However, when I try it with the relative address on my website, it fails.

X509Certificate2("/files/myfile.pfx") // fails
0

There are 0 answers