Debian Codegraph @

upstream/debian-unstable/man3/PKCS12_key_gen_utf8_ex.3ssl

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 "PKCS12_KEY_GEN_UTF8_EX 3SSL"
58 .TH PKCS12_KEY_GEN_UTF8_EX 3SSL 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 PKCS12_key_gen_asc, PKCS12_key_gen_asc_ex,
65 PKCS12_key_gen_uni, PKCS12_key_gen_uni_ex,
66 PKCS12_key_gen_utf8, PKCS12_key_gen_utf8_ex \- PKCS#12 Password based key derivation
67 .SH SYNOPSIS
68 .IX Header "SYNOPSIS"
69 .Vb 1
70 \& #include <openssl/pkcs12.h>
71 \&
72 \& int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
73 \& int saltlen, int id, int iter, int n,
74 \& unsigned char *out, const EVP_MD *md_type);
75 \& int PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt,
76 \& int saltlen, int id, int iter, int n,
77 \& unsigned char *out, const EVP_MD *md_type,
78 \& OSSL_LIB_CTX *ctx, const char *propq);
79 \& int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
80 \& int saltlen, int id, int iter, int n,
81 \& unsigned char *out, const EVP_MD *md_type);
82 \& int PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt,
83 \& int saltlen, int id, int iter, int n,
84 \& unsigned char *out, const EVP_MD *md_type,
85 \& OSSL_LIB_CTX *ctx, const char *propq);
86 \& int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,
87 \& int saltlen, int id, int iter, int n,
88 \& unsigned char *out, const EVP_MD *md_type);
89 \& int PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt,
90 \& int saltlen, int id, int iter, int n,
91 \& unsigned char *out, const EVP_MD *md_type,
92 \& OSSL_LIB_CTX *ctx, const char *propq);
93 .Ve
94 .SH DESCRIPTION
95 .IX Header "DESCRIPTION"
96 These methods perform a key derivation according to PKCS#12 (RFC7292)
97 with an input password \fIpass\fR of length \fIpasslen\fR, a salt \fIsalt\fR of length
98 \&\fIsaltlen\fR, an iteration count \fIiter\fR and a digest algorithm \fImd_type\fR.
99 The ID byte \fIid\fR determines how the resulting key is intended to be used:
100 .IP \(bu 4
101 If ID=1, then the pseudorandom bits being produced are to be used
102 as key material for performing encryption or decryption.
103 .IP \(bu 4
104 If ID=2, then the pseudorandom bits being produced are to be used
105 as an IV (Initial Value) for encryption or decryption.
106 .IP \(bu 4
107 If ID=3, then the pseudorandom bits being produced are to be used
108 as an integrity key for MACing.
109 .PP
110 The intended format of the supplied password is determined by the method chosen:
111 .IP \(bu 4
112 \&\fBPKCS12_key_gen_asc()\fR and \fBPKCS12_key_gen_asc_ex()\fR expect an ASCII-formatted password.
113 .IP \(bu 4
114 \&\fBPKCS12_key_gen_uni()\fR and \fBPKCS12_key_gen_uni_ex()\fR expect a Unicode-formatted password.
115 .IP \(bu 4
116 \&\fBPKCS12_key_gen_utf8()\fR and \fBPKCS12_key_gen_utf8_ex()\fR expect a UTF\-8 encoded password.
117 .PP
118 \&\fIpass\fR is the password used in the derivation of length \fIpasslen\fR. \fIpass\fR
119 is an optional parameter and can be NULL. If \fIpasslen\fR is \-1, then the
120 function will calculate the length of \fIpass\fR using \fBstrlen()\fR.
121 .PP
122 \&\fIsalt\fR is the salt used in the derivation of length \fIsaltlen\fR. If the
123 \&\fIsalt\fR is NULL, then \fIsaltlen\fR must be 0. The function will not
124 attempt to calculate the length of the \fIsalt\fR because it is not assumed to
125 be NULL terminated.
126 .PP
127 \&\fIiter\fR is the iteration count and its value should be greater than or
128 equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any
129 \&\fIiter\fR less than 1 is treated as a single iteration.
130 .PP
131 \&\fIdigest\fR is the message digest function used in the derivation.
132 .PP
133 The derived key will be written to \fIout\fR. The size of the \fIout\fR buffer
134 is specified via \fIn\fR.
135 .PP
136 Functions ending in \fB_ex()\fR allow for a library context \fIctx\fR and property query
137 \&\fIpropq\fR to be used to select algorithm implementations.
138 .SH NOTES
139 .IX Header "NOTES"
140 A typical application of this function is to derive keying material for an
141 encryption algorithm from a password in the \fIpass\fR, a salt in \fIsalt\fR,
142 and an iteration count.
143 .PP
144 Increasing the \fIiter\fR parameter slows down the algorithm which makes it
145 harder for an attacker to perform a brute force attack using a large number
146 of candidate passwords.
147 .SH "RETURN VALUES"
148 .IX Header "RETURN VALUES"
149 Returns 1 on success or 0 on error.
150 .SH "CONFORMING TO"
151 .IX Header "CONFORMING TO"
152 IETF RFC 7292 (<https://tools.ietf.org/html/rfc7292>)
153 .SH "SEE ALSO"
154 .IX Header "SEE ALSO"
155 \&\fBPKCS12_create_ex\fR\|(3),
156 \&\fBPKCS12_pbe_crypt_ex\fR\|(3),
157 \&\fBpassphrase\-encoding\fR\|(7)
158 .SH HISTORY
159 .IX Header "HISTORY"
160 \&\fBPKCS12_key_gen_asc_ex()\fR, \fBPKCS12_key_gen_uni_ex()\fR and \fBPKCS12_key_gen_utf8_ex()\fR
161 were added in OpenSSL 3.0.
162 .SH COPYRIGHT
163 .IX Header "COPYRIGHT"
164 Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
165 .PP
166 Licensed under the Apache License 2.0 (the "License"). You may not use
167 this file except in compliance with the License. You can obtain a copy
168 in the file LICENSE in the source distribution or at
169 <https://www.openssl.org/source/license.html>.