Skip to content

DeriveKey Method ​

Definition ​

  • Namespace: JASE.Interfaces
  • Assembly: JASE.dll

byte[] DeriveKey(string passphrase, byte[] salt, KeyDerivationAlgorithm? algorithm = null, int length = null, int? iterations = null, HashProvider? hashProvider = null) ​

csharp
byte[] DeriveKey(string passphrase, byte[] salt, KeyDerivationAlgorithm? algorithm = null, int length = null, int? iterations = null, HashProvider? hashProvider = null)

Derives a cryptographic key from a passphrase and salt using the configured or specified key derivation algorithm.

Parameters ​

NameDescription
algorithmOptional. The key derivation algorithm to use. If null, the default configured algorithm is used.
hashProviderOptional. Specifies the underlying hash algorithm to use (e.g., SHA256, SHA512). Defaults to the configured or core default provider.
iterationsThe number of hash iterations to perform. Defaults to 10,000.
lengthThe desired length of the derived key in bytes. Must be between 16 and 64 bytes.
passphraseThe passphrase to use for key derivation. Must meet the minimum length requirement.
saltThe cryptographic salt.

Returns ​

The derived key as a byte array.