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