RSA.Decrypt Method

Definition

Overloads

Decrypt(Byte[], RSAEncryptionPadding)

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

Decrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

Decrypts the input data using the specified padding mode.

Decrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

Decrypts the input data using the specified padding mode.

Decrypt(Byte[], RSAEncryptionPadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

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

public virtual byte[] Decrypt (byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding);
public abstract byte[] Decrypt (byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding);

Parameters

data
Byte[]

The data to decrypt.

padding
RSAEncryptionPadding

The padding mode.

Returns

Byte[]

The decrypted 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 not equal to the number of bytes for KeySize.

-or-

This instance represents only a public key.

-or-

The decryption operation failed.

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

Decrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Decrypts the input data using the specified padding mode.

public byte[] Decrypt (ReadOnlySpan<byte> data, System.Security.Cryptography.RSAEncryptionPadding padding);

Parameters

data
ReadOnlySpan<Byte>

The data to decrypt.

padding
RSAEncryptionPadding

The padding mode.

Returns

Byte[]

The decrypted data.

Exceptions

padding is null.

padding is unknown, or not supported by this implementation.

-or-

The decryption operation failed.

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9

Decrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Decrypts the input data using the specified padding mode.

public int Decrypt (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.RSAEncryptionPadding padding);

Parameters

data
ReadOnlySpan<Byte>

The data to decrypt.

destination
Span<Byte>

The buffer to receive the decrypted data.

padding
RSAEncryptionPadding

The padding mode.

Returns

The total number of bytes written to destination.

Exceptions

padding is null.

The buffer in destination is too small to hold the decrypted data.

padding is unknown, or not supported by this implementation.

-or-

The decryption operation failed.

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9