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
}