RSA.Encrypt Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
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.
This implementation has not implemented one of Encrypt(Byte[], RSAEncryptionPadding) or TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32).
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.
- 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.
This implementation has not implemented one of Encrypt(Byte[], RSAEncryptionPadding) or TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32).