System.Security.Cryptography.X509Certificates.X509Store.Add C# (CSharp) Method

Add() public method

public Add ( System certificate ) : void
certificate System
return void
        public void Add(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
        {
        }

Same methods

X509Store::Add ( X509Certificate2 certificate ) : void

Usage Example

Beispiel #1
0
        public void SetUp()
        {
            X509Certificate2 testCA = new X509Certificate2("../../imports/CA.cer");
            X509Certificate2 testCA2 = new X509Certificate2("../../imports/CA2.cer");
            X509Certificate2 testCA3 = new X509Certificate2("../../imports/specimenCa.cer");

            X509Certificate2 testIntCA = new X509Certificate2("../../imports/specimenCitizenCa.cer");

            X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadWrite | OpenFlags.OpenExistingOnly);
            try
            {
                if (!store.Certificates.Contains(testCA))
                {
                    store.Add(testCA);
                }
                if (!store.Certificates.Contains(testCA2))
                {
                    store.Add(testCA2);
                }
                if (!store.Certificates.Contains(testCA3))
                {
                    store.Add(testCA3);
                }
            }
            finally
            {
                store.Close();
            }
        }
All Usage Examples Of System.Security.Cryptography.X509Certificates.X509Store::Add