コード例 #1
0
ファイル: RSACng.ImportExport.cs プロジェクト: z77ma/runtime
        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
ファイル: ECDsaCng.cs プロジェクト: mikem8361/runtime
 private void AcceptImport(CngPkcs8.Pkcs8Response response)
 {
     try
     {
         Key = response.Key;
     }
     catch
     {
         response.FreeKey();
         throw;
     }
 }
コード例 #3
0
        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);
        }