System.Security.Cryptography.X509Certificates.X509Certificate.Export C# (CSharp) Method

Export() public method

public Export ( X509ContentType contentType, string password ) : byte[]
contentType X509ContentType
password string
return byte[]
        public virtual byte[] Export(X509ContentType contentType, string password)
        {
            VerifyContentType(contentType);

            if (Pal == null)
                throw new CryptographicException(ErrorCode.E_POINTER);  // Not the greatest error, but needed for backward compat.

            using (var safePasswordHandle = new SafePasswordHandle(password))
            using (IExportPal storePal = StorePal.FromCertificate(Pal))
            {
                return storePal.Export(contentType, safePasswordHandle);
            }
        }

Same methods

X509Certificate::Export ( System contentType ) : byte[]
X509Certificate::Export ( System contentType, System password ) : byte[]
X509Certificate::Export ( System contentType, string password ) : byte[]
X509Certificate::Export ( X509ContentType contentType ) : byte[]
X509Certificate::Export ( X509ContentType contentType, SecureString password ) : byte[]

Usage Example

コード例 #1
0
ファイル: Program.cs プロジェクト: nobitagamer/Nowin
 public void UpdateCertificate(X509Certificate cert)
 {
     _updateCertificate.UpdateCertificate(cert);
     File.WriteAllBytes(CertPathOnDisk, cert.Export(X509ContentType.Pfx, CertPassword));
     _lastUpdate = DateTime.UtcNow;
     LogInfo("Certificate successfully updated");
 }
All Usage Examples Of System.Security.Cryptography.X509Certificates.X509Certificate::Export