Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I do that in bouncyCastle (get installed certificates)?

Ok, I am quite new to the crypto world of bouncyCastle, and perhaps is a mental block, I can't seem to find(/google for) the equivalent to:

X509Store store = 
new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);

I think it might be the easiest and dumbest thing, but how can I access the windows installed certificates, using bouncy castle?

Or if I can't, how can i convert my System.Security.Cryptography.X509Certificates.X509Certificate2 to Org.BouncyCastle.X509.X509Certificate?

like image 794
marcelo-ferraz Avatar asked Jul 01 '11 14:07

marcelo-ferraz


1 Answers

Bouncycastle doesn't have access to Windows certificates store, that is the role of Microsoft's .NET classes. To convert between .NET certificates and their Bouncycastle equivalents look at the methods in the Org.BouncyCastle.Security.DotNetUtilities class, particularly the ToX509Certificate and FromX509Certificate methods.

like image 178
President James K. Polk Avatar answered Oct 20 '22 09:10

President James K. Polk