简体   繁体   中英

C# new X509Certificate2(path) PKCS#7/P7B -> System.Security.Cryptography.CryptographicException: 'Cannot find object or property'

When trying to create a new certificate from a PKCS#7 ( .p7b )-file I get the following exception: System.Security.Cryptography.CryptographicException: 'Cannot find object or property'

I get the same error if I read from file or byte array. I can create X509Certificate2 with .pem or .p12 files this way without a problem. Why is this happening?

new X509Certificate2(path);
new X509Certificate2(byteArray);

we had a similar error and Cryp32's suggestion to use X509Certificate2Collection.Import method worked well. Please mark it as as valid solution to the issue if it worked in your case as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM