/usr/lib/swipl/library/ext/ssl/crypto.pl
All Application Manual Name SummaryHelp

  • ext
    • ssl
      • ssl.pl -- Secure Socket Layer (SSL) library
      • crypto.pl -- Cryptography and authentication library
        • crypto_n_random_bytes/2
        • crypto_data_hash/3
        • crypto_file_hash/3
        • crypto_context_new/2
        • crypto_data_context/3
        • crypto_context_hash/2
        • crypto_open_hash_stream/3
        • crypto_stream_hash/2
        • crypto_password_hash/2
        • crypto_password_hash/3
        • crypto_data_hkdf/4
        • ecdsa_sign/4
        • ecdsa_verify/4
        • hex_bytes/2
        • rsa_private_decrypt/4
        • rsa_private_encrypt/4
        • rsa_public_decrypt/4
        • rsa_public_encrypt/4
        • rsa_sign/4
        • rsa_verify/4
        • crypto_data_decrypt/6
        • crypto_data_encrypt/6
        • crypto_modular_inverse/3
        • crypto_generate_prime/3
        • crypto_is_prime/2
        • crypto_name_curve/2
        • crypto_curve_order/2
        • crypto_curve_generator/2
        • crypto_curve_scalar_mult/4
      • xmlenc.pl -- XML encryption library
      • xmldsig.pl -- XML Digital signature
 crypto_data_hkdf(+Data, +Length, -Bytes, +Options) is det
Concentrate possibly dispersed entropy of Data and then expand it to the desired length. Bytes is unified with a list of bytes of length Length, and is suitable as input keying material and initialization vectors to the symmetric encryption predicates.

Admissible options are:

algorithm(+Algorithm)
A hashing algorithm as specified to crypto_data_hash/3. The default is a cryptographically secure algorithm. If you specify a variable, then it is unified with the algorithm that was used.
info(+Info)
Optional context and application specific information, specified as an atom, string or list of bytes. The default is the zero length atom ''.
salt(+List)
Optionally, a list of bytes that are used as salt. The default is all zeroes.
encoding(+Atom)
Either utf8 (default) or octet, denoting the representation of Data as in crypto_data_hash/3.

The info/1 option can be used to generate multiple keys from a single master key, using for example values such as key and iv, or the name of a file that is to be encrypted.

This predicate requires OpenSSL 1.1.0 or greater.

See also
- crypto_n_random_bytes/2 to obtain a suitable salt.
- crypto_data_hash/3 to compute a HMAC signature.