public void FromPem_PublicKey(string pem) { var key = ECJwk.FromPem(pem); ECParameters ecParameters = key.ExportParameters(true); ECParameters expected = GetNistP256ReferenceKey(false); AssertEqual(expected, ecParameters); Assert.False(key.HasPrivateKey); }
public void FromPem_UnexpectedKeyType_ThrowArgumentException() { string pem = @" -----BEGIN RSA PUBLIC KEY----- MEgCQQC3P1n17ovVXiS3/wKa0WqFQ8ltJT5UMZuTUyxBw8FHe4nbLS8z17modFhI 4GqOaDtQRFEeG8o2JSfhfPQrOAYVAgMBAAE= -----END RSA PUBLIC KEY-----"; Assert.Throws <InvalidOperationException>(() => ECJwk.FromPem(pem)); }