1PKCS12_PBE_KEYIVGEN(3ossl)          OpenSSL         PKCS12_PBE_KEYIVGEN(3ossl)
2
3
4

NAME

6       PKCS12_PBE_keyivgen, PKCS12_PBE_keyivgen_ex, PKCS12_pbe_crypt,
7       PKCS12_pbe_crypt_ex - PKCS#12 Password based encryption
8

SYNOPSIS

10        #include <openssl/evp.h>
11
12        int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
13                                ASN1_TYPE *param, const EVP_CIPHER *cipher,
14                                const EVP_MD *md_type, int en_de);
15        int PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
16                                   ASN1_TYPE *param, const EVP_CIPHER *cipher,
17                                   const EVP_MD *md_type, int en_de,
18                                   OSSL_LIB_CTX *libctx, const char *propq);
19        unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,
20                                        const char *pass, int passlen,
21                                        const unsigned char *in, int inlen,
22                                        unsigned char **data, int *datalen,
23                                        int en_de);
24        unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor,
25                                           const char *pass, int passlen,
26                                           const unsigned char *in, int inlen,
27                                           unsigned char **data, int *datalen,
28                                           int en_de, OSSL_LIB_CTX *libctx,
29                                           const char *propq);
30

DESCRIPTION

32       PKCS12_PBE_keyivgen() and PKCS12_PBE_keyivgen_ex() take a password pass
33       of length passlen, parameters param and a message digest function
34       md_type and perform a key derivation according to PKCS#12. The
35       resulting key is then used to initialise the cipher context ctx with a
36       cipher cipher for encryption (en_de=1) or decryption (en_de=0).
37
38       PKCS12_PBE_keyivgen_ex() also allows the application to specify a
39       library context libctx and property query propq to select appropriate
40       algorithm implementations.
41
42       PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() will encrypt or decrypt a
43       buffer based on the algorithm in algor and password pass of length
44       passlen.  The input is from in of length inlen and output is into a
45       malloc'd buffer returned in *data of length datalen. The operation is
46       determined by en_de, encryption (en_de=1) or decryption (en_de=0).
47
48       PKCS12_pbe_crypt_ex() allows the application to specify a library
49       context libctx and property query propq to select appropriate algorithm
50       implementations.
51
52       pass is the password used in the derivation of length passlen. pass is
53       an optional parameter and can be NULL. If passlen is -1, then the
54       function will calculate the length of pass using strlen().
55
56       salt is the salt used in the derivation of length saltlen. If the salt
57       is NULL, then saltlen must be 0. The function will not attempt to
58       calculate the length of the salt because it is not assumed to be NULL
59       terminated.
60
61       iter is the iteration count and its value should be greater than or
62       equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any
63       iter less than 1 is treated as a single iteration.
64
65       digest is the message digest function used in the derivation.
66
67       Functions ending in _ex() take optional parameters libctx and propq
68       which are used to select appropriate algorithm implementations.
69

NOTES

71       The functions are typically used in PKCS#12 to encrypt objects.
72
73       These functions make no assumption regarding the given password.  It
74       will simply be treated as a byte sequence.
75

RETURN VALUES

77       PKCS12_PBE_keyivgen(), PKCS12_PBE_keyivgen_ex() return 1 on success or
78       0 on error.
79
80       PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() return a buffer containing
81       the output or NULL if an error occurred.
82

CONFORMING TO

84       IETF RFC 7292 (<https://tools.ietf.org/html/rfc7292>)
85

SEE ALSO

87       EVP_PBE_CipherInit_ex(3), PKCS8_encrypt_ex(3), passphrase-encoding(7)
88

HISTORY

90       PKCS12_PBE_keyivgen_ex() and PKCS12_pbe_crypt_ex() were added in
91       OpenSSL 3.0.
92
94       Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.
95
96       Licensed under the Apache License 2.0 (the "License").  You may not use
97       this file except in compliance with the License.  You can obtain a copy
98       in the file LICENSE in the source distribution or at
99       <https://www.openssl.org/source/license.html>.
100
101
102
1033.0.5                             2022-11-01        PKCS12_PBE_KEYIVGEN(3ossl)
Impressum