Skip to content

ICryptoTools Interface ​

Definition ​

Encryption related tools

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

Methods ​

NameDescription
string Base64UrlEncode(ReadOnlySpan<byte> data)Returns data as a url encoded base64 string
bool CompareBytes(ReadOnlySpan<byte> bytes, ReadOnlySpan<byte> to)Cryptographically secure means to compare two byte arrays
bool CompareBytes(byte[] bytes, byte[] to)Cryptographically secure means to compare two byte arrays
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.
byte[] DeriveKeyFromPassphrase(string passphrase, byte[] salt, KeyDerivationAlgorithm? algorithm, int keySize, int? iterations = null, HashProvider? hashProvider = null)Performs secure key derivation using PBKDF2 with configurable algorithm, key size, iteration count, and hash provider.
string GeneratePassword()Generate a password with the Default complexity options
string GeneratePassword(IPasswordOptions options)Generate a password with the requested complexity options
string GeneratePassword(int length)Generate a password with the Default complexity options modifie for length
bool GetRandomNumbers(byte[] target)Populates an array of bytes using a cryptographically secure random number generator Internally this uses System.Security.Cryptography.RandomNumberGenerator
byte[] GetRandomNumbers(int length)Generates a cryptographically secure array of bytes of the requested length. Internally this uses System.Security.Cryptography.RandomNumberGenerator
string PasswordHash(string password, IArgon2Options options = null)Hashes a password using Argon2 with optional configuration.
bool PasswordVerify(string password, string hash)Verifies a plaintext password against an Argon2 hash string.
byte[] PemDecode(string pem, string keyString = null)Decode a PEM encoded certificate and return as an array of bytes
string PemEncode(byte[] data, string keyString = null)Encode a byte[] to a PEM encoded string
bool ValidatePasswordComplexity(string password, IPasswordOptions options)Validate complexity or provided password against PasswordOption rules
bool ValidatePasswordComplexity(string password, IPasswordOptions options, out string failureReason)Validate complexity or provided password against PasswordOption rules