Appearance
Symmetric Encryption
Prefer AES-GCM for new data
AesGcm is the recommended path: authenticated encryption with a documented envelope (AesEnvelopeFormat).
csharp
using JASE.Crypto;
// Raw 256-bit key
byte[] key = /* 32 cryptographically random bytes */;
string cipherText = AesGcm.Encrypt("payload", key);
string plain = AesGcm.Decrypt(cipherText, key);
// Passphrase + salt (PBKDF2 parameters travel with JaseV1 envelopes)
string salt = "application-static-salt"; // prefer per-secret random salt in production
string sealedPayload = AesGcm.Encrypt(
"payload",
passPhrase: "sufficiently-long-passphrase",
salt: salt,
format: AesEnvelopeFormat.JaseV1);
string opened = AesGcm.Decrypt(sealedPayload, "sufficiently-long-passphrase", salt, format: AesEnvelopeFormat.JaseV1);Use AesGcmOptions when you need associated data (AAD), explicit iteration counts, or a fixed format.
Pitfalls
- Wrong AAD or key → authentication failure (
CryptographicException), not silent garbage plaintext - Passphrase decrypt without salt: only self-describing envelope overloads omit salt; know which overload you used at encrypt time
- Do not invent your own framing around GCM ciphertext — use the library envelope
Classic AES (Symmetric)
Symmetric provides AES (and legacy algorithms) with IV-prepended ciphertext, plus EncryptWithPassword / DecryptWithPassword (PBKDF2-HMAC-SHA256 self-describing container).
Use this when:
- You already have data in the JASE password or raw-key AES layouts
- You need CBC-style interoperability that AES-GCM cannot provide
For new confidentiality requirements, prefer AesGcm.
Legacy proprietary decrypt-only helpers exist for migration — re-encrypt into GCM or the modern password container when you touch the data.
Related
- Overview: JASE.Crypto
- Deprecation / wire-format policy:
docs/crypto-deprecation-policy.mdin the Suite repo