X509 Cannot find requested object
c#, x509, x509certificate
Solution
You can just pass the filename into the new() method.
Try:
X509Certificate2 x509 = new X509Certificate2(certificateFile);
If the certificate has a password, you must also supply this (where `password` is a String):
X509Certificate2 x509 = new X509Certificate2(certificateFile, password);
Problem
I have a certificate.cer file in the same directory (copy if newer) with the RSA key inside yet when I try: ``` string certificateFile = Environment.CurrentDirectory + "\\Certificate.cer"; X509Certificate2 x509 = new X509Certificate2(X509Certificate.CreateFromCertFile(certificateFile)); ``` I get the same "Cannot find requested object" error. How can I not get the error?