示例#1
0
        private void ProcessPkcs8Response(CngPkcs8.Pkcs8Response response)
        {
            // Wrong algorithm?
            if (response.GetAlgorithmGroup() != BCryptNative.AlgorithmName.RSA)
            {
                response.FreeKey();
                throw new CryptographicException(SR.Cryptography_NotValidPublicOrPrivateKey);
            }

            AcceptImport(response);
        }
示例#2
0
 private void AcceptImport(CngPkcs8.Pkcs8Response response)
 {
     try
     {
         Key = response.Key;
     }
     catch
     {
         response.FreeKey();
         throw;
     }
 }
        private void ProcessPkcs8Response(CngPkcs8.Pkcs8Response response)
        {
            // Wrong algorithm?
            switch (response.GetAlgorithmGroup())
            {
            // CNG ECDH and ECDSA keys can both do ECDSA.
            case BCryptNative.AlgorithmName.ECDsa:
            case BCryptNative.AlgorithmName.ECDH:
                AcceptImport(response);
                return;
            }

            response.FreeKey();
            throw new CryptographicException(SR.Cryptography_NotValidPublicOrPrivateKey);
        }