MSDN Library

System.Net.Security.CertificateStoreFlags Enum

Namespace: System.Net.Security

Specifies flags that control the behavior of certificate store operations.

Syntax

public enum CertificateStoreFlags

Remarks

This enumeration is used with methods such as X509Store.Open to specify how the certificate store should be opened and accessed.

Members

Examples

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);
        }
    }
}