public void LoadCertificateWithOnlyPublicKeyAllowed() { using X509Certificate2 certificate = PemReader.LoadCertificate(PEMPublicKey.AsSpan(), CertificateBytes, allowCertificateOnly: true); Assert.AreEqual("CN=Azure SDK", certificate.Subject); Assert.IsFalse(certificate.HasPrivateKey); }
public void LoadCertificateWithoutPrivateKey() { Exception ex = Assert.Throws <InvalidDataException>(() => PemReader.LoadCertificate(PEMPublicKey.AsSpan())); Assert.AreEqual("The certificate is missing the private key", ex.Message); }