1=pod
2
3=head1 NAME
4
5PKCS12_gen_mac, PKCS12_setup_mac, PKCS12_set_mac,
6PKCS12_verify_mac - Functions to create and manipulate a PKCS#12 structure
7
8=head1 SYNOPSIS
9
10 #include <openssl/pkcs12.h>
11
12 int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
13                    unsigned char *mac, unsigned int *maclen);
14 int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);
15 int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
16                    unsigned char *salt, int saltlen, int iter,
17                    const EVP_MD *md_type);
18 int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
19                      int saltlen, const EVP_MD *md_type);
20
21=head1 DESCRIPTION
22
23PKCS12_gen_mac() generates an HMAC over the entire PKCS#12 object using the
24supplied password along with a set of already configured parameters.
25The default key generation mechanism used is PKCS12KDF.
26
27PKCS12_verify_mac() verifies the PKCS#12 object's HMAC using the supplied
28password.
29
30PKCS12_setup_mac() sets the MAC part of the PKCS#12 structure with the supplied
31parameters.
32
33PKCS12_set_mac() sets the MAC and MAC parameters into the PKCS#12 object.
34
35I<pass> is the passphrase to use in the HMAC. I<salt> is the salt value to use,
36I<iter> is the iteration count and I<md_type> is the message digest
37function to use.
38
39=head1 NOTES
40
41If I<salt> is NULL then a suitable salt will be generated and used.
42
43If I<iter> is 1 then an iteration count will be omitted from the PKCS#12
44structure.
45
46PKCS12_gen_mac(), PKCS12_verify_mac() and PKCS12_set_mac() make assumptions
47regarding the encoding of the given passphrase. See L<passphrase-encoding(7)>
48for more information.
49
50=head1 RETURN VALUES
51
52All functions return 1 on success and 0 if an error occurred.
53
54=head1 CONFORMING TO
55
56IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
57
58=head1 SEE ALSO
59
60L<d2i_PKCS12(3)>,
61L<EVP_KDF-PKCS12KDF(7)>,
62L<PKCS12_create(3)>,
63L<passphrase-encoding(7)>
64
65=head1 COPYRIGHT
66
67Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.
68
69Licensed under the Apache License 2.0 (the "License").  You may not use
70this file except in compliance with the License.  You can obtain a copy
71in the file LICENSE in the source distribution or at
72L<https://www.openssl.org/source/license.html>.
73
74=cut
75