Appearance
Encrypt Method
Definition
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Overloads
byte[] Encrypt(byte[] input, AesGcmOptions options)
csharp
byte[] Encrypt(byte[] input, AesGcmOptions options)Encrypts a byte array using AES-GCM with the provided associated AesGcmOptions
byte[] Encrypt(byte[] input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)
csharp
byte[] Encrypt(byte[] input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Encrypts a byte array using AES-GCM with the given key and optional associated metadata.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
input | The input data to be encrypted as a byte array. |
key | The encryption key. |
Returns
The encrypted data as a byte array.
byte[] Encrypt(byte[] input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)
csharp
byte[] Encrypt(byte[] input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Encrypts a string using AES-GCM with a passphrase and salt.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
encoding | Optional encoding for string conversions (default is UTF-8). |
input | The input data to be encrypted as a byte[]. |
iterations | The number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults. |
passPhrase | The passphrase used to derive the encryption key. |
salt | The salt used to derive the encryption key. |
Returns
The encrypted data as a Base64 encoded string.
byte[] Encrypt(byte[] input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)
csharp
byte[] Encrypt(byte[] input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Encrypts a string using AES-GCM with a passphrase and salt.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
encoding | Optional encoding for string conversions (default is UTF-8). |
input | The input data to be encrypted as a byte[]. |
iterations | The number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults. |
passPhrase | The passphrase used to derive the encryption key. |
salt | The salt used to derive the encryption key. |
Returns
The encrypted data as a Base64 encoded string.
string Encrypt(string input, AesGcmOptions options)
csharp
string Encrypt(string input, AesGcmOptions options)Encrypts a string using AES-GCM with the provided associated AesGcmOptions
string Encrypt(string input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)
csharp
string Encrypt(string input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Encrypts a string using AES-GCM with the given key and optional associated metadata.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
encoding | Optional encoding for string conversions (default is UTF-8). |
input | The input data to be encrypted as a string. |
key | The encryption key. |
Returns
The encrypted data as a Base64 encoded string.
string Encrypt(string input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)
csharp
string Encrypt(string input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Encrypts a string using AES-GCM with a passphrase and salt.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
encoding | Optional encoding for string conversions (default is UTF-8). |
input | The input data to be encrypted as a string. |
iterations | The number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults. |
passPhrase | The passphrase used to derive the encryption key. |
salt | The salt used to derive the encryption key. |
Returns
The encrypted data as a Base64 encoded string.
string Encrypt(string input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)
csharp
string Encrypt(string input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Encrypts a string using AES-GCM with a passphrase and salt.
Parameters
| Name | Description |
|---|---|
associatedMetaData | Optional associated metadata for the encryption. |
encoding | Optional encoding for string conversions (default is UTF-8). |
input | The input data to be encrypted as a string. |
iterations | The number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults. |
passPhrase | The passphrase used to derive the encryption key. |
salt | The salt used to derive the encryption key. |
Returns
The encrypted data as a Base64 encoded string.