RSA.Encrypt(Byte[], RSAEncryptionPadding) Method

Definition

When overridden in a derived class, encrypts the input data using the specified padding mode.

public:
 virtual cli::array <System::Byte> ^ Encrypt(cli::array <System::Byte> ^ data, System::Security::Cryptography::RSAEncryptionPadding ^ padding);
public virtual byte[] Encrypt (byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding);
abstract member Encrypt : byte[] * System.Security.Cryptography.RSAEncryptionPadding -> byte[]
override this.Encrypt : byte[] * System.Security.Cryptography.RSAEncryptionPadding -> byte[]
Public Overridable Function Encrypt (data As Byte(), padding As RSAEncryptionPadding) As Byte()

Parameters

data
Byte[]

The data to encrypt.

padding
RSAEncryptionPadding

The padding mode.

Returns

Byte[]

The encrypted data.

Exceptions

data or padding is null.

A derived class must override this method.

padding is unknown, or not supported by this implementation.

-or-

The length of data is too long for the combination of KeySize and the selected padding.

-or-

The encryption operation failed.

Applies to

See also