klyn.cryptography.SecretKeyFactory.generateSecret
method
public generateSecret(spec as PBEKeySpec) as String throws CryptoException:
Description
Derives key material from a password-based specification.
import klyn.cryptography

factory = PBKDF2(SHA256())
spec = PBEKeySpec("password", "salty", 100000, 32)
print(factory.generateSecret(spec))
Parameters
  • spec Password-based derivation specification.
  • outputEncoding Output encoding: `hex`, `base64` or `base64url`.
Returns
Encoded derived key material.
Throws
  • CryptoException when derivation fails. ```klyn import klyn.cryptography factory = PBKDF2(SHA256()) spec = PBEKeySpec("password", "salty", 100000, 32) print(factory.generateSecret(spec)) ```