RSACryptoServiceProvider.Decrypt Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Decrypts data with the RSA algorithm.

Namespace:  System.Security.Cryptography
Assembly:  mscorlib.Extensions (in mscorlib.Extensions.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function Decrypt ( _
    rgb As Byte(), _
    fOAEP As Boolean _
) As Byte()
[SecuritySafeCriticalAttribute]
public byte[] Decrypt(
    byte[] rgb,
    bool fOAEP
)

Parameters

  • rgb
    Type: array<System.Byte[]
    The data to be decrypted.
  • fOAEP
    Type: System.Boolean
    true to perform direct RSA decryption using OAEP padding; otherwise, false to use PKCS#1 v1.5 padding.

Return Value

Type: array<System.Byte[]
The decrypted data, which is the original plain text before encryption.

Exceptions

Exception Condition
CryptographicException

The cryptographic service provider (CSP) cannot be acquired.

-or-

The fOAEP parameter is true and the length of the rgb parameter is greater than KeySize.

-or-

The fOAEP parameter is true and OAEP is not supported.

ArgumentNullException

rgb is nulla null reference (Nothing in Visual Basic).

Remarks

Use Encrypt to encrypt data for decryption with this method.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.