Beispiel #1
0
 private static ECDiffieHellmanCngPublicKey GetECDiffieHellmanCngPublicKey(X509Certificate2 cert)
 {
     var keyAlgoDerBytes = cert.GetKeyAlgorithmParameters();
     var keyAlgoAsn1 = new Asn1InputStream(keyAlgoDerBytes).ReadObject();
     var keyAlgoOid = new DerObjectIdentifier(keyAlgoAsn1.ToString());
     var xmlImport = Rfc4050XmlMaker("ECDH", keyAlgoOid, cert);
     var ecDiffieHellmanCngPublicKey = ECDiffieHellmanCngPublicKey.FromXmlString(xmlImport);
     return ecDiffieHellmanCngPublicKey;
 }