/// <summary> /// Gets a <see cref="X509Certificate2" /> from a Base64-encoded certificate and private key. /// </summary> /// <param name="cert"></param> /// <param name="key"></param> /// <returns></returns> public static X509Certificate2 GetCertificate(string cert, string key) { return(GetCertificate(cert) .CopyWithPrivateKey ( PemExt.DecodeRsaPrivateKey ( PemExt.GetBytesFromPem ( key, "RSA PRIVATE KEY" ) ) )); }
public static (X509Certificate2, RSA) GetCertificateAndKey(string cert, string key) { return(GetCertificate(cert), PemExt.DecodeRsaPrivateKey(PemExt.GetBytesFromPem(key, "RSA PRIVATE KEY"))); }
/// <summary> /// Gets a <see cref="X509Certificate2" /> from a Base64-encoded certificate. /// </summary> /// <param name="cert"></param> /// <returns></returns> public static X509Certificate2 GetCertificate(string cert) { return(new X509Certificate2(PemExt.GetBytesFromPem(cert, "CERTIFICATE"))); }