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

EncryptEnvelopeKeyUsingAsymmetricKeyPair() private static method

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