RSACryptoServiceProvider.Encrypt Method

May 11, 2014

Encrypts data with the RSA algorithm.

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

public byte[] Encrypt(
	byte[] rgb,
	bool fOAEP
)

Parameters

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

Return Value

Type: System.Byte []
The encrypted data.

ExceptionCondition
CryptographicException

The cryptographic service provider (CSP) cannot be acquired.

-or-

The length of the rgb parameter is greater than the maximum allowed length.

-or-

The fOAEP parameter is true and OAEP padding is not supported.

ArgumentNullException

rgb is null.

Use Decrypt to decrypt the results of this method.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2014 Microsoft