Opc.Ua.CertificateIdentifier.GetPrivateKeyFilePath C# (CSharp) Method

GetPrivateKeyFilePath() public method

Gets the private key file path.
public GetPrivateKeyFilePath ( ) : Task
return Task
        public async Task<string> GetPrivateKeyFilePath()
        {
            X509Certificate2 certificate = await Find(false);

            if (certificate == null)
            {
                return null;
            }

            ICertificateStore store = CertificateStoreIdentifier.CreateStore(this.StoreType);

            try
            {
                store.Open(this.StorePath);
                return store.GetPrivateKeyFilePath(certificate.Thumbprint);
            }
            finally
            {
                store.Close();
            }
        }
        #endregion