Appearance
Encrypt Method
Definition
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Overloads
| Name | Description |
|---|---|
byte[] Encrypt(byte[] input, byte[] publicKey, RsaPadding padding = null) | Encrypts the specified data using an RSA public key in raw byte array format. |
byte[] Encrypt(byte[] input, string keyInXml, RsaPadding padding = null) | Encrypts the specified data using an RSA public key provided in XML format. |
byte[] Encrypt(byte[] input, X509Certificate2 certificate, RsaPadding padding = null, bool allowInvalidTime = null) | Encrypts the input data using the public key of the specified X.509 certificate. |
byte[] Encrypt(byte[] input, byte[] publicKey, RsaPadding padding = null)
csharp
byte[] Encrypt(byte[] input, byte[] publicKey, RsaPadding padding = null)Encrypts the specified data using an RSA public key in raw byte array format.
Parameters
| Name | Description |
|---|---|
input | The plaintext input data to encrypt. |
padding | The RSA padding scheme to use. Default is OaepSHA256. |
publicKey | The RSA public key used for encryption, provided as a byte array. |
Returns
A byte array containing the encrypted data.
byte[] Encrypt(byte[] input, X509Certificate2 certificate, RsaPadding padding = null, bool allowInvalidTime = null)
csharp
byte[] Encrypt(byte[] input, X509Certificate2 certificate, RsaPadding padding = null, bool allowInvalidTime = null)Encrypts the input data using the public key of the specified X.509 certificate.
Parameters
| Name | Description |
|---|---|
allowInvalidTime | Boolean to enforce certificate time frame validity |
certificate | The X.509 certificate containing the public key used for encryption. |
input | The input data to encrypt. |
padding | The RSA padding scheme to use. Default is OaepSHA256. |
Returns
The encrypted data.
byte[] Encrypt(byte[] input, string keyInXml, RsaPadding padding = null)
csharp
byte[] Encrypt(byte[] input, string keyInXml, RsaPadding padding = null)Encrypts the specified data using an RSA public key provided in XML format.
Parameters
| Name | Description |
|---|---|
input | The plaintext input data to encrypt. |
keyInXml | The RSA public key in XML format. Must be a valid XML string. |
padding | The RSA padding scheme to use. Default is OaepSHA256. |
Returns
A byte array containing the encrypted data.