CertificateStore Constructor (X509Store) |
Namespace: MailBee.Security
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | x509Store is a null reference (Nothing in Visual Basic). |
In most cases, you won't need CertificateStore class at all. For instance, to load certificate store from a file (like PFX), use Import(Byte) method, you can then pass X509Certificate2Collection to the method like Decrypt2(MailMessage, X509Certificate2Collection).
Note |
---|
This is the only CertificateStore constructor available in .NET Standard 2.0 edition. Other constructors are Win32-specific and can be considered deprecated. |
// To use the code below, import these namespace at the top of your code using MailBee.Security; using System.Security.Cryptography.X509Certificates; // The actual code (put it into a method of your class). X509Store personalX509Store = new X509Store(StoreName.My, StoreLocation.CurrentUser); personalX509Store.Open(OpenFlags.OpenExistingOnly); CertificateStore store = new CertificateStore(personalX509Store); // You can use it now. Once done, be sure to Dispose personalX509Store!