6 kdf - perform Key Derivation Function operations
20 The key derivation functions generate a derived key from either a secret or
29 Print a usage message.
31 =item B<-keylen> I<num>
33 The output size of the derived key. This field is required.
35 =item B<-out> I<filename>
37 Filename to output to, or standard output by default.
41 Output the derived key in binary form. Uses hexadecimal text format if not specified.
43 =item B<-kdfopt> I<nm:v>
45 Passes options to the KDF algorithm.
46 A comprehensive list of controls can be found in the EVP_KDF_CTX implementation
48 Common control strings used by EVP_KDF_ctrl_str() are:
52 =item B<key:>I<string>
54 Specifies the secret key as an alphanumeric string (use if the key contains
55 printable characters only).
56 The string length must conform to any restrictions of the KDF algorithm.
57 A key must be specified for most KDF algorithms.
59 =item B<hexkey:>I<string>
61 Specifies the secret key in hexadecimal form (two hex digits per byte).
62 The key length must conform to any restrictions of the KDF algorithm.
63 A key must be specified for most KDF algorithms.
65 =item B<pass:>I<string>
67 Specifies the password as an alphanumeric string (use if the password contains
68 printable characters only).
69 The password must be specified for PBKDF2 and scrypt.
71 =item B<hexpass:>I<string>
73 Specifies the password in hexadecimal form (two hex digits per byte).
74 The password must be specified for PBKDF2 and scrypt.
76 =item B<digest:>I<string>
78 Specifies the name of a digest as an alphanumeric string.
79 To see the list of supported digests, use the command I<list -digest-commands>.
85 Specifies the name of a supported KDF algorithm which will be used.
86 The supported algorithms names are TLS1-PRF, HKDF, SSKDF, PBKDF2, SSHKDF and id-scrypt.
92 Use TLS1-PRF to create a hex-encoded derived key from a secret key and seed:
94 openssl kdf -keylen 16 -kdfopt digest:SHA256 -kdfopt key:secret \
95 -kdfopt seed:seed TLS1-PRF
97 Use HKDF to create a hex-encoded derived key from a secret key, salt and info:
99 openssl kdf -keylen 10 -kdfopt digest:SHA256 -kdfopt key:secret \
100 -kdfopt salt:salt -kdfopt info:label HKDF
102 Use SSKDF with KMAC to create a hex-encoded derived key from a secret key, salt and info:
104 openssl kdf -keylen 64 -kdfopt mac:KMAC128 -kdfopt maclen:20 \
105 -kdfopt hexkey:b74a149a161545 -kdfopt hexinfo:348a37a2 \
106 -kdfopt hexsalt:3638271ccd68a2 SSKDF
108 Use SSKDF with HMAC to create a hex-encoded derived key from a secret key, salt and info:
110 openssl kdf -keylen 16 -kdfopt mac:HMAC -kdfopt digest:SHA256 \
111 -kdfopt hexkey:b74a149a -kdfopt hexinfo:348a37a2 \
112 -kdfopt hexsalt:3638271c SSKDF
114 Use SSKDF with Hash to create a hex-encoded derived key from a secret key, salt and info:
116 openssl kdf -keylen 14 -kdfopt digest:SHA256 \
117 -kdfopt hexkey:6dbdc23f045488 \
118 -kdfopt hexinfo:a1b2c3d4 SSKDF
120 Use SSHKDF to create a hex-encoded derived key from a secret key, hash and session_id:
122 openssl kdf -keylen 16 -kdfopt digest:SHA256 \
123 -kdfopt hexkey:0102030405 \
124 -kdfopt hexxcghash:06090A \
125 -kdfopt hexsession_id:01020304 \
126 -kdfopt type:A SSHKDF
128 Use PBKDF2 to create a hex-encoded derived key from a password and salt:
130 openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password \
131 -kdfopt salt:salt -kdfopt iter:2 PBKDF2
133 Use scrypt to create a hex-encoded derived key from a password and salt:
135 openssl kdf -keylen 64 -kdfopt pass:password -kdfopt salt:NaCl \
136 -kdfopt N:1024 -kdfopt r:8 -kdfopt p:16 \
137 -kdfopt maxmem_bytes:10485760 id-scrypt
141 The KDF mechanisms that are available will depend on the options
142 used when building OpenSSL.
148 L<EVP_KDF_TLS1_PRF(7)>
160 Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
162 Licensed under the OpenSSL license (the "License"). You may not use
163 this file except in compliance with the License. You can obtain a copy
164 in the file LICENSE in the source distribution or at
165 L<https://www.openssl.org/source/license.html>.