예제 #1
0
        public void LoadCertificateWithPublicKey()
        {
#if NET461
            Assert.Ignore("Loading X509Certificate2 with private EC key not supported on this platform");
#endif
            using X509Certificate2 certificate = PemReader.LoadCertificate(ECDsaPrivateKey.AsSpan(), cer: s_ecdsaCertificateBytes, keyType: PemReader.KeyType.ECDsa);
            Assert.AreEqual("CN=Azure SDK", certificate.Subject);
            Assert.IsTrue(certificate.HasPrivateKey);
        }
예제 #2
0
        public void LoadCertificateWithoutPublicKey()
        {
            Exception ex = Assert.Throws <InvalidDataException>(() => PemReader.LoadCertificate(ECDsaPrivateKey.AsSpan(), keyType: PemReader.KeyType.ECDsa));

            Assert.AreEqual("The certificate is missing the public key", ex.Message);
        }