public override byte[] Export(X509ContentType contentType, string password) { X509Helper.ThrowIfContextInvalid(Impl); using (var handle = new SafePasswordHandle(password)) { return(Impl.Export(contentType, handle)); } }
// strangly there are no DateTime returning function public virtual string GetExpirationDateString() { if (hideDates) { return(null); } X509Helper.ThrowIfContextInvalid(impl); return(impl.GetValidUntil().ToLocalTime().ToString()); }
// strangly there are no DateTime returning function public virtual string GetEffectiveDateString() { if (hideDates) { return(null); } X509Helper.ThrowIfContextInvalid(impl); return(impl.GetValidFrom().ToLocalTime().ToString()); }
internal static void ExportAsPEM(X509Certificate certificate, Stream stream, bool includeHumanReadableForm) { #if MONO_FEATURE_BTLS X509Helper.ThrowIfContextInvalid(certificate.Impl); using (var x509 = GetNativeInstance(certificate.Impl)) using (var bio = MonoBtlsBio.CreateMonoStream(stream)) x509.ExportAsPEM(bio, includeHumanReadableForm); #else throw new PlatformNotSupportedException(); #endif }
internal static long GetSubjectNameHash(X509Certificate certificate) { #if MONO_FEATURE_BTLS X509Helper.ThrowIfContextInvalid(certificate.Impl); using (var x509 = GetNativeInstance(certificate.Impl)) using (var subject = x509.GetSubjectName()) return(subject.GetHash()); #else throw new PlatformNotSupportedException(); #endif }
public virtual byte[] GetKeyAlgorithmParameters() { X509Helper.ThrowIfContextInvalid(impl); byte[] kap = impl.GetKeyAlgorithmParameters(); if (kap == null) { throw new CryptographicException(Locale.GetText("Parameters not part of the certificate")); } return(kap); }
public X509Certificate(System.Security.Cryptography.X509Certificates.X509Certificate cert) { if (cert == null) { throw new ArgumentNullException("cert"); } X509Helper.ThrowIfContextInvalid(cert.impl); impl = X509Helper.InitFromCertificate(cert.impl); hideDates = false; }
internal byte[] Export(X509ContentType contentType, byte[] password) { try { X509Helper.ThrowIfContextInvalid(impl); return(impl.Export(contentType, password)); } finally { // protect password if (password != null) { Array.Clear(password, 0, password.Length); } } }
static MonoBtlsX509 GetNativeInstance(X509CertificateImpl impl) { X509Helper.ThrowIfContextInvalid(impl); var btlsImpl = impl as X509CertificateImplBtls; if (btlsImpl != null) { return(btlsImpl.X509.Copy()); } else { return(MonoBtlsX509.LoadFromData(impl.GetRawCertData(), MonoBtlsX509Format.DER)); } }
public virtual byte[] GetSerialNumber() { X509Helper.ThrowIfContextInvalid(impl); return(impl.GetSerialNumber()); }
public virtual string GetRawCertDataString() { X509Helper.ThrowIfContextInvalid(impl); return(X509Helper.ToHexString(impl.GetRawCertData())); }
public virtual byte[] GetRawCertData() { X509Helper.ThrowIfContextInvalid(impl); return(impl.GetRawCertData()); }
public virtual string GetName() { X509Helper.ThrowIfContextInvalid(impl); return(impl.GetSubjectName(true)); }
public virtual string GetKeyAlgorithm() { X509Helper.ThrowIfContextInvalid(impl); return(impl.GetKeyAlgorithm()); }
public virtual byte[] Export(X509ContentType contentType, SecureString password) { X509Helper.ThrowIfContextInvalid(impl); using (var handle = new SafePasswordHandle(password)) return(impl.Export(contentType, handle)); }
internal static void ThrowIfContextInvalid(X509CertificateImpl impl) { X509Helper.ThrowIfContextInvalid(impl); }
internal void ThrowIfInvalid() { X509Helper.ThrowIfContextInvalid(impl); }
public virtual byte[] GetPublicKey() { X509Helper.ThrowIfContextInvalid(impl); return(impl.GetPublicKey()); }