PKCS12_gen_mac.pod 2.1 KB

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