Skip to content

Configuration Class ​

Definition ​

Configuration for Encryption operations. Overrides any conflicting property names from JASE CoreConfig.

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

Fields ​

NameDescription
DEFAULT_ITERATIONSThe deefaut value used for iteration count for the key derivation function when not supplied by the caller.

Properties ​

NameDescription
AesGcmDefaultFormatDefault envelope format for for AesGcm encryption/decryption (Default: Raw )
AesGcmNonceByteSizeGets the size in bytes to use for an AesGcm Nonce
AesGcmTagByteSizeGets the tag size in bytes to use for an AesGcm tag
DefaultEncodingGet the default Text encoding to be used in Encryption operation
DefaultHashProviderGet the default hash provider to be used in hashing operations
DefaultKeyDerivationAlgorithmGet the default Key Derivation Algorithm to use when performing Key Derivation operations
DefaultRsaSignaturePaddingGet the default Rsa Signature Padding for certificate operations (Default: Pss)
IsFrozenGets a value indicating whether the configuration has been frozen via Freeze.
MinimumAuthKeyBytesThe minimum length (in bytes) required for authentication keys used in HMAC validation.
MinimumIterationsGets the default number of iterations when performing Key Derivation operations
MinimumPassphraseLengthSets the minimum length of a Passphrase when performing Key Derivation operations (Default: 32)
MinimumSaltBytesThe minimum length (in bytes) required for salts used in Symmetric encryption operations.

Methods ​

NameDescription
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.