Amazon.S3.Encryption.EncryptionUtils.DecryptEnvelopeKeyUsingAsymmetricKeyPair C# (CSharp) Method

DecryptEnvelopeKeyUsingAsymmetricKeyPair() private static method

private static DecryptEnvelopeKeyUsingAsymmetricKeyPair ( AsymmetricAlgorithm asymmetricAlgorithm, byte encryptedEnvelopeKey ) : byte[]
asymmetricAlgorithm System.Security.Cryptography.AsymmetricAlgorithm
encryptedEnvelopeKey byte
return byte[]
        private static byte[] DecryptEnvelopeKeyUsingAsymmetricKeyPair(AsymmetricAlgorithm asymmetricAlgorithm, byte[] encryptedEnvelopeKey)
        {
#if CORECLR
            RSA rsaCrypto = asymmetricAlgorithm as RSA;
            if (rsaCrypto == null)
            {
                throw new NotSupportedException("RSA is the only supported algorithm with this method.");
            }
            return rsaCrypto.Decrypt(encryptedEnvelopeKey, RSAEncryptionPadding.Pkcs1);
#else
            RSACryptoServiceProvider rsaCrypto = asymmetricAlgorithm as RSACryptoServiceProvider;
            return rsaCrypto.Decrypt(encryptedEnvelopeKey, false);
#endif
        }