xref: /freebsd/crypto/openssl/doc/man3/PKCS12_gen_mac.pod (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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 paramters.
25
26PKCS12_verify_mac() verifies the PKCS#12 object's HMAC using the supplied
27password.
28
29PKCS12_setup_mac() sets the MAC part of the PKCS#12 structure with the supplied
30parameters.
31
32PKCS12_set_mac() sets the MAC and MAC parameters into the PKCS#12 object.
33
34I<pass> is the passphrase to use in the HMAC. I<salt> is the salt value to use,
35I<iter> is the iteration count and I<md_type> is the message digest
36function to use.
37
38=head1 NOTES
39
40If I<salt> is NULL then a suitable salt will be generated and used.
41
42If I<iter> is 1 then an iteration count will be omitted from the PKCS#12
43structure.
44
45PKCS12_gen_mac(), PKCS12_verify_mac() and PKCS12_set_mac() make assumptions
46regarding the encoding of the given passphrase. See L<passphrase-encoding(7)>
47for more information.
48
49=head1 RETURN VALUES
50
51All functions return 1 on success and 0 if an error occurred.
52
53=head1 CONFORMING TO
54
55IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
56
57=head1 SEE ALSO
58
59L<d2i_PKCS12(3)>,
60L<PKCS12_create(3)>,
61L<passphrase-encoding(7)>
62
63=head1 COPYRIGHT
64
65Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
66
67Licensed under the Apache License 2.0 (the "License").  You may not use
68this file except in compliance with the License.  You can obtain a copy
69in the file LICENSE in the source distribution or at
70L<https://www.openssl.org/source/license.html>.
71
72=cut
73