Debian Codegraph @

upstream/debian-unstable/man1/openssl-kdf.1ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OPENSSL-KDF 1SSL"
58 .TH OPENSSL-KDF 1SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 openssl\-kdf \- perform Key Derivation Function operations
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 \&\fBopenssl kdf\fR
68 [\fB\-help\fR]
69 [\fB\-cipher\fR]
70 [\fB\-digest\fR]
71 [\fB\-mac\fR]
72 [\fB\-kdfopt\fR \fInm\fR:\fIv\fR]
73 [\fB\-keylen\fR \fInum\fR]
74 [\fB\-out\fR \fIfilename\fR]
75 [\fB\-binary\fR]
76 [\fB\-provider\fR \fIname\fR]
77 [\fB\-provider\-path\fR \fIpath\fR]
78 [\fB\-provparam\fR \fI[name:]key=value\fR]
79 [\fB\-propquery\fR \fIpropq\fR]
80 \&\fIkdf_name\fR
81 .SH DESCRIPTION
82 .IX Header "DESCRIPTION"
83 The key derivation functions generate a derived key from either a secret or
84 password.
85 .SH OPTIONS
86 .IX Header "OPTIONS"
87 .IP \fB\-help\fR 4
88 .IX Item "-help"
89 Print a usage message.
90 .IP "\fB\-keylen\fR \fInum\fR" 4
91 .IX Item "-keylen num"
92 The output size of the derived key. This field is required.
93 .IP "\fB\-out\fR \fIfilename\fR" 4
94 .IX Item "-out filename"
95 Filename to output to, or standard output by default.
96 .IP \fB\-binary\fR 4
97 .IX Item "-binary"
98 Output the derived key in binary form. Uses hexadecimal text format if not specified.
99 .IP "\fB\-cipher\fR \fIname\fR" 4
100 .IX Item "-cipher name"
101 Specify the cipher to be used by the KDF.
102 Not all KDFs require a cipher and it is an error to use this option in such
103 cases.
104 .IP "\fB\-digest\fR \fIname\fR" 4
105 .IX Item "-digest name"
106 Specify the digest to be used by the KDF.
107 Not all KDFs require a digest and it is an error to use this option in such
108 cases.
109 To see the list of supported digests, use \f(CW\*(C`openssl list \-digest\-commands\*(C'\fR.
110 .IP "\fB\-mac\fR \fIname\fR" 4
111 .IX Item "-mac name"
112 Specify the MAC to be used by the KDF.
113 Not all KDFs require a MAC and it is an error to use this option in such
114 cases.
115 .IP "\fB\-kdfopt\fR \fInm\fR:\fIv\fR" 4
116 .IX Item "-kdfopt nm:v"
117 Passes options to the KDF algorithm.
118 A comprehensive list of parameters can be found in "PARAMETERS" in \fBEVP_KDF\fR\|(3).
119 Common parameter names used by \fBEVP_KDF_CTX_set_params()\fR are:
120 .RS 4
121 .IP \fBkey:\fR\fIstring\fR 4
122 .IX Item "key:string"
123 Specifies the secret key as an alphanumeric string (use if the key contains
124 printable characters only).
125 The string length must conform to any restrictions of the KDF algorithm.
126 A key must be specified for most KDF algorithms.
127 .IP \fBhexkey:\fR\fIstring\fR 4
128 .IX Item "hexkey:string"
129 Alternative to the \fBkey:\fR option where
130 the secret key is specified in hexadecimal form (two hex digits per byte).
131 .IP \fBpass:\fR\fIstring\fR 4
132 .IX Item "pass:string"
133 Specifies the password as an alphanumeric string (use if the password contains
134 printable characters only).
135 The password must be specified for PBKDF2 and scrypt.
136 .IP \fBhexpass:\fR\fIstring\fR 4
137 .IX Item "hexpass:string"
138 Alternative to the \fBpass:\fR option where
139 the password is specified in hexadecimal form (two hex digits per byte).
140 .IP \fBsalt:\fR\fIstring\fR 4
141 .IX Item "salt:string"
142 Specifies a non-secret unique cryptographic salt as an alphanumeric string
143 (use if it contains printable characters only).
144 The length must conform to any restrictions of the KDF algorithm.
145 A salt parameter is required for several KDF algorithms,
146 such as \fBEVP_KDF\-PBKDF2\fR\|(7).
147 .IP \fBhexsalt:\fR\fIstring\fR 4
148 .IX Item "hexsalt:string"
149 Alternative to the \fBsalt:\fR option where
150 the salt is specified in hexadecimal form (two hex digits per byte).
151 .IP \fBinfo:\fR\fIstring\fR 4
152 .IX Item "info:string"
153 Some KDF implementations, such as \fBEVP_KDF\-HKDF\fR\|(7), take an 'info' parameter
154 for binding the derived key material
155 to application\- and context-specific information.
156 Specifies the info, fixed info, other info or shared info argument
157 as an alphanumeric string (use if it contains printable characters only).
158 The length must conform to any restrictions of the KDF algorithm.
159 .IP \fBhexinfo:\fR\fIstring\fR 4
160 .IX Item "hexinfo:string"
161 Alternative to the \fBinfo:\fR option where
162 the info is specified in hexadecimal form (two hex digits per byte).
163 .IP \fBdigest:\fR\fIstring\fR 4
164 .IX Item "digest:string"
165 This option is identical to the \fB\-digest\fR option.
166 .IP \fBcipher:\fR\fIstring\fR 4
167 .IX Item "cipher:string"
168 This option is identical to the \fB\-cipher\fR option.
169 .IP \fBmac:\fR\fIstring\fR 4
170 .IX Item "mac:string"
171 This option is identical to the \fB\-mac\fR option.
172 .RE
173 .RS 4
174 .RE
175 .IP "\fB\-provider\fR \fIname\fR" 4
176 .IX Item "-provider name"
177 .PD 0
178 .IP "\fB\-provider\-path\fR \fIpath\fR" 4
179 .IX Item "-provider-path path"
180 .IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4
181 .IX Item "-provparam [name:]key=value"
182 .IP "\fB\-propquery\fR \fIpropq\fR" 4
183 .IX Item "-propquery propq"
184 .PD
185 See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
186 .IP \fIkdf_name\fR 4
187 .IX Item "kdf_name"
188 Specifies the name of a supported KDF algorithm which will be used.
189 The supported algorithms names include TLS1\-PRF, HKDF, SSKDF, PBKDF2,
190 SSHKDF, X942KDF\-ASN1, X942KDF\-CONCAT, X963KDF and SCRYPT.
191 .SH EXAMPLES
192 .IX Header "EXAMPLES"
193 Use TLS1\-PRF to create a hex-encoded derived key from a secret key and seed:
194 .PP
195 .Vb 2
196 \& openssl kdf \-keylen 16 \-kdfopt digest:SHA2\-256 \-kdfopt key:secret \e
197 \& \-kdfopt seed:seed TLS1\-PRF
198 .Ve
199 .PP
200 Use HKDF to create a hex-encoded derived key from a secret key, salt and info:
201 .PP
202 .Vb 2
203 \& openssl kdf \-keylen 10 \-kdfopt digest:SHA2\-256 \-kdfopt key:secret \e
204 \& \-kdfopt salt:salt \-kdfopt info:label HKDF
205 .Ve
206 .PP
207 Use SSKDF with KMAC to create a hex-encoded derived key from a secret key, salt and info:
208 .PP
209 .Vb 3
210 \& openssl kdf \-keylen 64 \-kdfopt mac:KMAC\-128 \-kdfopt maclen:20 \e
211 \& \-kdfopt hexkey:b74a149a161545 \-kdfopt hexinfo:348a37a2 \e
212 \& \-kdfopt hexsalt:3638271ccd68a2 SSKDF
213 .Ve
214 .PP
215 Use SSKDF with HMAC to create a hex-encoded derived key from a secret key, salt and info:
216 .PP
217 .Vb 3
218 \& openssl kdf \-keylen 16 \-kdfopt mac:HMAC \-kdfopt digest:SHA2\-256 \e
219 \& \-kdfopt hexkey:b74a149a \-kdfopt hexinfo:348a37a2 \e
220 \& \-kdfopt hexsalt:3638271c SSKDF
221 .Ve
222 .PP
223 Use SSKDF with Hash to create a hex-encoded derived key from a secret key, salt and info:
224 .PP
225 .Vb 3
226 \& openssl kdf \-keylen 14 \-kdfopt digest:SHA2\-256 \e
227 \& \-kdfopt hexkey:6dbdc23f045488 \e
228 \& \-kdfopt hexinfo:a1b2c3d4 SSKDF
229 .Ve
230 .PP
231 Use SSHKDF to create a hex-encoded derived key from a secret key, hash and session_id:
232 .PP
233 .Vb 5
234 \& openssl kdf \-keylen 16 \-kdfopt digest:SHA2\-256 \e
235 \& \-kdfopt hexkey:0102030405 \e
236 \& \-kdfopt hexxcghash:06090A \e
237 \& \-kdfopt hexsession_id:01020304 \e
238 \& \-kdfopt type:A SSHKDF
239 .Ve
240 .PP
241 Use PBKDF2 to create a hex-encoded derived key from a password and salt:
242 .PP
243 .Vb 2
244 \& openssl kdf \-keylen 32 \-kdfopt digest:SHA256 \-kdfopt pass:password \e
245 \& \-kdfopt salt:salt \-kdfopt iter:2 PBKDF2
246 .Ve
247 .PP
248 Use scrypt to create a hex-encoded derived key from a password and salt:
249 .PP
250 .Vb 3
251 \& openssl kdf \-keylen 64 \-kdfopt pass:password \-kdfopt salt:NaCl \e
252 \& \-kdfopt n:1024 \-kdfopt r:8 \-kdfopt p:16 \e
253 \& \-kdfopt maxmem_bytes:10485760 SCRYPT
254 .Ve
255 .SH NOTES
256 .IX Header "NOTES"
257 The KDF mechanisms that are available will depend on the options
258 used when building OpenSSL.
259 .SH "SEE ALSO"
260 .IX Header "SEE ALSO"
261 \&\fBopenssl\fR\|(1),
262 \&\fBopenssl\-pkeyutl\fR\|(1),
263 \&\fBEVP_KDF\fR\|(3),
264 \&\fBEVP_KDF\-SCRYPT\fR\|(7),
265 \&\fBEVP_KDF\-TLS1_PRF\fR\|(7),
266 \&\fBEVP_KDF\-PBKDF2\fR\|(7),
267 \&\fBEVP_KDF\-HKDF\fR\|(7),
268 \&\fBEVP_KDF\-SS\fR\|(7),
269 \&\fBEVP_KDF\-SSHKDF\fR\|(7),
270 \&\fBEVP_KDF\-X942\-ASN1\fR\|(7),
271 \&\fBEVP_KDF\-X942\-CONCAT\fR\|(7),
272 \&\fBEVP_KDF\-X963\fR\|(7)
273 .SH HISTORY
274 .IX Header "HISTORY"
275 Added in OpenSSL 3.0
276 .SH COPYRIGHT
277 .IX Header "COPYRIGHT"
278 Copyright 2019\-2023 The OpenSSL Project Authors. All Rights Reserved.
279 .PP
280 Licensed under the Apache License 2.0 (the "License"). You may not use
281 this file except in compliance with the License. You can obtain a copy
282 in the file LICENSE in the source distribution or at
283 <https://www.openssl.org/source/license.html>.