X509 Cannot find requested object
11,764
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);
Author by
user2191209
Updated on June 04, 2022Comments
-
user2191209 almost 2 years
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?