X509CertificateImplBtls(X509CertificateImplBtls other) { x509 = other.x509 != null?other.x509.Copy() : null; nativePrivateKey = other.nativePrivateKey != null?other.nativePrivateKey.Copy() : null; if (other.intermediateCerts != null) { intermediateCerts = other.intermediateCerts.Clone(); } }
X509CertificateImplBtls(X509CertificateImplBtls other) { disallowFallback = other.disallowFallback; x509 = other.x509 != null?other.x509.Copy() : null; privateKey = other.privateKey != null?other.privateKey.Copy() : null; if (other.intermediateCerts != null) { intermediateCerts = other.intermediateCerts.Clone(); } }
X509CertificateImplBtls(X509CertificateImplBtls other) { disallowFallback = other.disallowFallback; x509 = other.x509 != null?other.x509.Copy() : null; nativePrivateKey = other.nativePrivateKey != null?other.nativePrivateKey.Copy() : null; fallback = other.fallback != null ? (X509Certificate2Impl)other.fallback.Clone() : null; if (other.intermediateCerts != null) { intermediateCerts = other.intermediateCerts.Clone(); } }
public override void Reset() { if (x509 != null) { x509.Dispose(); x509 = null; } if (nativePrivateKey != null) { nativePrivateKey.Dispose(); nativePrivateKey = null; } publicKey = null; intermediateCerts = null; }
void ImportPkcs12(byte[] data, SafePasswordHandle password) { using (var pkcs12 = new MonoBtlsPkcs12()) { if (password == null || password.IsInvalid) { try { // Support both unencrypted PKCS#12.. pkcs12.Import(data, null); } catch { // ..and PKCS#12 encrypted with an empty password using (var empty = new SafePasswordHandle(string.Empty)) pkcs12.Import(data, empty); } } else { pkcs12.Import(data, password); } x509 = pkcs12.GetCertificate(0); if (pkcs12.HasPrivateKey) { nativePrivateKey = pkcs12.GetPrivateKey(); } if (pkcs12.Count > 1) { intermediateCerts = new X509CertificateImplCollection(); for (int i = 0; i < pkcs12.Count; i++) { using (var ic = pkcs12.GetCertificate(i)) { if (MonoBtlsX509.Compare(ic, x509) == 0) { continue; } var impl = new X509CertificateImplBtls(ic); intermediateCerts.Add(impl, true); } } } } }
public override void Reset() { if (x509 != null) { x509.Dispose(); x509 = null; } if (nativePrivateKey != null) { nativePrivateKey = null; } subjectName = null; issuerName = null; archived = false; publicKey = null; intermediateCerts = null; if (fallback != null) { fallback.Reset(); } }