Appearance
EncryptWithPassword Method
Definition
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Overloads
| Name | Description |
|---|---|
byte[] EncryptWithPassword(byte[] data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null) | Encrypts data with a passphrase using PBKDF2-HMAC-SHA256. The derivation parameters travel with the output so other libraries can reproduce the key. Layout: saltLen(1) ‖ salt ‖ iterations(uint32 BE) ‖ IV ‖ ciphertext. |
string EncryptWithPassword(string data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null) | Encrypts a string with a passphrase using PBKDF2-HMAC-SHA256, returning Base64 of the self-describing password container. |
byte[] EncryptWithPassword(byte[] data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)
csharp
byte[] EncryptWithPassword(byte[] data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)Encrypts data with a passphrase using PBKDF2-HMAC-SHA256. The derivation parameters travel with the output so other libraries can reproduce the key. Layout: saltLen(1) ‖ salt ‖ iterations(uint32 BE) ‖ IV ‖ ciphertext.
Parameters
| Name | Description |
|---|---|
algorithm | Symmetric algorithm (default AES-256). |
data | The plaintext to encrypt. |
iterations | PBKDF2 iteration count (default DEFAULT_ITERATIONS). |
padding | Block padding mode (default PKCS7). |
password | The passphrase. PBKDF2 uses its UTF-8 bytes. |
salt | Per-message salt (8–255 bytes; 16+ recommended). |
Returns
The self-describing password container.
string EncryptWithPassword(string data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)
csharp
string EncryptWithPassword(string data, string password, byte[] salt, int iterations = null, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)Encrypts a string with a passphrase using PBKDF2-HMAC-SHA256, returning Base64 of the self-describing password container.
Parameters
| Name | Description |
|---|---|
algorithm | Symmetric algorithm (default AES-256). |
data | The plaintext string to encrypt. |
iterations | PBKDF2 iteration count (default DEFAULT_ITERATIONS). |
padding | Block padding mode (default PKCS7). |
password | The passphrase. PBKDF2 uses its UTF-8 bytes. |
salt | Per-message salt (8–255 bytes; 16+ recommended). |
Returns
Base64-encoded password container.