Specifies flags that control the behavior of certificate store operations.
public enum CertificateStoreFlags
This enumeration is used with methods such as X509Store.Open to specify how the certificate store should be opened and accessed.
No special flags are specified. The default behavior is used.
Opens the certificate store in read-only mode. Modifications are not allowed.
Opens the certificate store only if it already exists. If the store does not exist, the operation fails.
Includes archived certificates in the store operations. By default, archived certificates are excluded.
The following C# code example demonstrates how to open a certificate store in read-only mode.
using System; using System.Net.Security; using System.Security.Cryptography.X509Certificates; public class Example { public static void Main() { try { using (X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser)) { store.Open(OpenFlags.ReadOnly); // Perform read-only operations on the store Console.WriteLine("Certificate store opened in read-only mode."); } } catch (Exception ex) { Console.WriteLine("An error occurred: " + ex.Message); } } }