แก้ไข

แชร์ผ่าน


RSA.Encrypt Method

Definition

Overloads

Encrypt(Byte[], RSAEncryptionPadding)

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

Encrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

Encrypts the input data using the specified padding mode.

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

Encrypts the input data using the specified padding mode.

Encrypt(Byte[], RSAEncryptionPadding)

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

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:
 abstract 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);
public abstract 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[]
abstract member Encrypt : byte[] * System.Security.Cryptography.RSAEncryptionPadding -> byte[]
Public Overridable Function Encrypt (data As Byte(), padding As RSAEncryptionPadding) As Byte()
Public MustOverride 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.

See also

Applies to

Encrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

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

Encrypts the input data using the specified padding mode.

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

Parameters

data
ReadOnlySpan<Byte>

The data to encrypt.

padding
RSAEncryptionPadding

The padding mode.

Returns

Byte[]

The encrypted data.

Exceptions

padding is null.

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

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

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

Encrypts the input data using the specified padding mode.

public:
 int Encrypt(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::RSAEncryptionPadding ^ padding);
public int Encrypt (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.RSAEncryptionPadding padding);
member this.Encrypt : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.RSAEncryptionPadding -> int
Public Function Encrypt (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), padding As RSAEncryptionPadding) As Integer

Parameters

data
ReadOnlySpan<Byte>

The data to encrypt.

destination
Span<Byte>

The buffer to receive the encrypted 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 encrypted data.

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