Appearance
Configuration Class
Definition
Configuration for Encryption operations. Overrides any conflicting property names from JASE CoreConfig.
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Fields
| Name | Description |
|---|---|
DEFAULT_ITERATIONS | The deefaut value used for iteration count for the key derivation function when not supplied by the caller. |
Properties
| Name | Description |
|---|---|
AesGcmDefaultFormat | Default envelope format for for AesGcm encryption/decryption (Default: Raw ) |
AesGcmNonceByteSize | Gets the size in bytes to use for an AesGcm Nonce |
AesGcmTagByteSize | Gets the tag size in bytes to use for an AesGcm tag |
DefaultEncoding | Get the default Text encoding to be used in Encryption operation |
DefaultHashProvider | Get the default hash provider to be used in hashing operations |
DefaultKeyDerivationAlgorithm | Get the default Key Derivation Algorithm to use when performing Key Derivation operations |
DefaultRsaSignaturePadding | Get the default Rsa Signature Padding for certificate operations (Default: Pss) |
IsFrozen | Gets a value indicating whether the configuration has been frozen via Freeze. |
MinimumAuthKeyBytes | The minimum length (in bytes) required for authentication keys used in HMAC validation. |
MinimumIterations | Gets the default number of iterations when performing Key Derivation operations |
MinimumPassphraseLength | Sets the minimum length of a Passphrase when performing Key Derivation operations (Default: 32) |
MinimumSaltBytes | The minimum length (in bytes) required for salts used in Symmetric encryption operations. |
Methods
| Name | Description |
|---|---|
void Freeze() | Freezes the configuration so the process-wide defaults can no longer be mutated. Call this once at the end of application startup, after any desired Set* calls. After freezing, every mutator throws InvalidOperationException. This is a deliberate one-way latch. |
void SetAesGcmNonceByteSize(int value) | Set the size in bytes to use for an AesGcm Nonce |
void SetAesGcmTagByteSize(int value) | Set the tag size in bytes to use for an AesGcm tag |
void SetDefaultEncoding(Encoding encoding) | Sets the default Text encoding to be used in Encryption operations when no explicit encoding is specified. |
void SetDefaultHashProvider(HashProvider provider) | Sets the default hash provider to be used in Encryption operations when no explicit provider is specified. |
void SetDefaultKeyDerivationAlgorithm(KeyDerivationAlgorithm algorithm) | Get the default Key Derivation Algorithm to use when performing Key Derivation operations |
void SetDefaultRsaSignaturePadding(RsaSignaturePadding mode) | Set the default Rsa Signature Padding for certificate operations |
void SetMinimumAuthKeyBytes(int value) | Sets the minimum length (in bytes) required for authentication keys used in HMAC validation. |
void SetMinimumIterations(int iterations) | Sets the number of iterations when performing Key Derivation operations |
void SetMinimumPassphraseLength(int length) | Sets the minimum length of a Passphrase when performing Key Derivation operations |
void SetMinimumSaltBytes(int value) | Sets the minimum length (in bytes) required for salts used in Symmetric encryption operations. |
Remarks
These values are process-wide defaults. They are intended to be configured once at application startup, before any concurrent cryptographic operations begin. The setters are not synchronized: mutating a default while other threads are encrypting/decrypting is a data race and can yield inconsistent behavior across operations.
Prefer passing explicit options to each operation over relying on (or mutating) these globals. For AES-GCM, WithGcmSizes overrides the nonce/tag sizes for a single operation without touching this shared state.
To enforce the set-once pattern, call Freeze at the end of application startup. Once frozen, any subsequent attempt to mutate a default throws InvalidOperationException, turning a silent mid-run race into an immediate, loud failure. Reads remain lock-free and are published via volatile backing fields so they are never stale across threads.