Skip to content

CreateWithArgon2id Method ​

Definition ​

  • Namespace: JASE.Crypto
  • Assembly: JASE.Crypto.dll

AesGcmOptions CreateWithArgon2id(string passphrase, string salt, IArgon2Options argon2Options = null, byte[] associatedData = null, Encoding encoding = null, AesEnvelopeFormat? format = null) ​

csharp
AesGcmOptions CreateWithArgon2id(string passphrase, string salt, IArgon2Options argon2Options = null, byte[] associatedData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)

Creates an AesGcmOptions instance by deriving a 256-bit key from a passphrase using the memory-hard Argon2id KDF. This is an opt-in alternative to the library-default PBKDF2 path; the Argon2 cost parameters are embedded in the resulting self-describing JaseV1 envelope so decryption needs only the passphrase.

Parameters ​

NameDescription
argon2OptionsOptional Argon2 cost parameters (memory, time, parallelism, variant). When , the library's recommended Argon2id baseline is used.
associatedDataOptional associated data (AAD) authenticated but not encrypted. Must be for JWE formats.
encodingText encoding used to interpret the passphrase/salt. If , DefaultEncoding is used.
formatOptional envelope format. Defaults to the self-describing JaseV1, which is required to round-trip Argon2id (raw/JWE formats cannot carry the cost parameters).
passphraseThe passphrase from which the AES key will be derived.
saltThe salt used during key derivation. Should be unique per key.

Returns ​

A configured AesGcmOptions instance using an Argon2id-derived key.