klyn.cryptography.SecretKeyFactory.generateSecret
method
public generateSecret(spec as PBEKeySpec) as String throws CryptoException:
Description

Derives key material from a password-based specification.

Parameters
ParameterDescription
specPassword-based derivation specification.
outputEncodingOutput encoding: hex, base64 or base64url.
Returns

Encoded derived key material.

Throws
  • CryptoException when derivation fails.
Example
import klyn.cryptography

factory = PBKDF2(SHA256())
spec = PBEKeySpec("password", "salty", 100000, 32)
print(factory.generateSecret(spec))