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