1OPENSSL-KDF(1ossl)                  OpenSSL                 OPENSSL-KDF(1ossl)
2
3
4

NAME

6       openssl-kdf - perform Key Derivation Function operations
7

SYNOPSIS

9       openssl kdf [-help] [-cipher] [-digest] [-mac] [-kdfopt nm:v] [-keylen
10       num] [-out filename] [-binary] [-provider name] [-provider-path path]
11       [-propquery propq] kdf_name
12

DESCRIPTION

14       The key derivation functions generate a derived key from either a
15       secret or password.
16

OPTIONS

18       -help
19           Print a usage message.
20
21       -keylen num
22           The output size of the derived key. This field is required.
23
24       -out filename
25           Filename to output to, or standard output by default.
26
27       -binary
28           Output the derived key in binary form. Uses hexadecimal text format
29           if not specified.
30
31       -cipher name
32           Specify the cipher to be used by the KDF.  Not all KDFs require a
33           cipher and it is an error to use this option in such cases.
34
35       -digest name
36           Specify the digest to be used by the KDF.  Not all KDFs require a
37           digest and it is an error to use this option in such cases.  To see
38           the list of supported digests, use "openssl list -digest-commands".
39
40       -mac name
41           Specify the MAC to be used by the KDF.  Not all KDFs require a MAC
42           and it is an error to use this option in such cases.
43
44       -kdfopt nm:v
45           Passes options to the KDF algorithm.  A comprehensive list of
46           parameters can be found in the EVP_KDF_CTX implementation
47           documentation.  Common parameter names used by
48           EVP_KDF_CTX_set_params() are:
49
50           key:string
51               Specifies the secret key as an alphanumeric string (use if the
52               key contains printable characters only).  The string length
53               must conform to any restrictions of the KDF algorithm.  A key
54               must be specified for most KDF algorithms.
55
56           hexkey:string
57               Specifies the secret key in hexadecimal form (two hex digits
58               per byte).  The key length must conform to any restrictions of
59               the KDF algorithm.  A key must be specified for most KDF
60               algorithms.
61
62           pass:string
63               Specifies the password as an alphanumeric string (use if the
64               password contains printable characters only).  The password
65               must be specified for PBKDF2 and scrypt.
66
67           hexpass:string
68               Specifies the password in hexadecimal form (two hex digits per
69               byte).  The password must be specified for PBKDF2 and scrypt.
70
71           digest:string
72               This option is identical to the -digest option.
73
74           cipher:string
75               This option is identical to the -cipher option.
76
77           mac:string
78               This option is identical to the -mac option.
79
80       -provider name
81       -provider-path path
82       -propquery propq
83           See "Provider Options" in openssl(1), provider(7), and property(7).
84
85       kdf_name
86           Specifies the name of a supported KDF algorithm which will be used.
87           The supported algorithms names include TLS1-PRF, HKDF, SSKDF,
88           PBKDF2, SSHKDF, X942KDF-ASN1, X942KDF-CONCAT, X963KDF and SCRYPT.
89

EXAMPLES

91       Use TLS1-PRF to create a hex-encoded derived key from a secret key and
92       seed:
93
94           openssl kdf -keylen 16 -kdfopt digest:SHA2-256 -kdfopt key:secret \
95                       -kdfopt seed:seed TLS1-PRF
96
97       Use HKDF to create a hex-encoded derived key from a secret key, salt
98       and info:
99
100           openssl kdf -keylen 10 -kdfopt digest:SHA2-256 -kdfopt key:secret \
101                       -kdfopt salt:salt -kdfopt info:label HKDF
102
103       Use SSKDF with KMAC to create a hex-encoded derived key from a secret
104       key, salt and info:
105
106           openssl kdf -keylen 64 -kdfopt mac:KMAC-128 -kdfopt maclen:20 \
107                       -kdfopt hexkey:b74a149a161545 -kdfopt hexinfo:348a37a2 \
108                       -kdfopt hexsalt:3638271ccd68a2 SSKDF
109
110       Use SSKDF with HMAC to create a hex-encoded derived key from a secret
111       key, salt and info:
112
113           openssl kdf -keylen 16 -kdfopt mac:HMAC -kdfopt digest:SHA2-256 \
114                       -kdfopt hexkey:b74a149a -kdfopt hexinfo:348a37a2 \
115                       -kdfopt hexsalt:3638271c SSKDF
116
117       Use SSKDF with Hash to create a hex-encoded derived key from a secret
118       key, salt and info:
119
120           openssl kdf -keylen 14 -kdfopt digest:SHA2-256 \
121                       -kdfopt hexkey:6dbdc23f045488 \
122                       -kdfopt hexinfo:a1b2c3d4 SSKDF
123
124       Use SSHKDF to create a hex-encoded derived key from a secret key, hash
125       and session_id:
126
127           openssl kdf -keylen 16 -kdfopt digest:SHA2-256 \
128                       -kdfopt hexkey:0102030405 \
129                       -kdfopt hexxcghash:06090A \
130                       -kdfopt hexsession_id:01020304 \
131                       -kdfopt type:A SSHKDF
132
133       Use PBKDF2 to create a hex-encoded derived key from a password and
134       salt:
135
136           openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password \
137                       -kdfopt salt:salt -kdfopt iter:2 PBKDF2
138
139       Use scrypt to create a hex-encoded derived key from a password and
140       salt:
141
142           openssl kdf -keylen 64 -kdfopt pass:password -kdfopt salt:NaCl \
143                       -kdfopt n:1024 -kdfopt r:8 -kdfopt p:16 \
144                       -kdfopt maxmem_bytes:10485760 SCRYPT
145

NOTES

147       The KDF mechanisms that are available will depend on the options used
148       when building OpenSSL.
149

SEE ALSO

151       openssl(1), openssl-pkeyutl(1), EVP_KDF(3), EVP_KDF-SCRYPT(7),
152       EVP_KDF-TLS1_PRF(7), EVP_KDF-PBKDF2(7), EVP_KDF-HKDF(7), EVP_KDF-SS(7),
153       EVP_KDF-SSHKDF(7), EVP_KDF-X942-ASN1(7), EVP_KDF-X942-CONCAT(7),
154       EVP_KDF-X963(7)
155

HISTORY

157       Added in OpenSSL 3.0
158
160       Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
161
162       Licensed under the Apache License 2.0 (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       <https://www.openssl.org/source/license.html>.
166
167
168
1693.1.1                             2023-08-31                OPENSSL-KDF(1ossl)
Impressum