Opc.Ua.CertificateStoreIdentifier.OpenStore C# (CSharp) Method

OpenStore() public static method

Opens the store.
public static OpenStore ( string path ) : ICertificateStore
path string The path.
return ICertificateStore
        public static ICertificateStore OpenStore(string path)
        {
            ICertificateStore store = CertificateStoreIdentifier.CreateStore(CertificateStoreIdentifier.DetermineStoreType(path));
            store.Open(path);
            return store;
        }
        #endregion

Same methods

CertificateStoreIdentifier::OpenStore ( ) : ICertificateStore

Usage Example

        public async Task<X509Certificate2Collection> GetCertificates()
        {
            X509Certificate2Collection collection = new X509Certificate2Collection();

            CertificateStoreIdentifier id = new CertificateStoreIdentifier();

            id.StoreType = this.StoreType;
            id.StorePath = this.StorePath;

            if (!String.IsNullOrEmpty(id.StorePath))
            {
                try
                {
                    ICertificateStore store = id.OpenStore();

                    try
                    {
                        collection = await store.Enumerate();
                    }
                    finally
                    {
                        store.Close();
                    }
                }
                catch (Exception)
                {
                    Utils.Trace("Could not load certificates from store: {0}.", this.StorePath);
                }
            }

            foreach (CertificateIdentifier trustedCertificate in TrustedCertificates)
            {
                X509Certificate2 certificate = await trustedCertificate.Find();

                if (certificate != null)
                {
                    collection.Add(certificate);
                }
            }

            return collection;
        }
All Usage Examples Of Opc.Ua.CertificateStoreIdentifier::OpenStore