PKCS12_add_safe.pod 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. =pod
  2. =head1 NAME
  3. PKCS12_add_safe, PKCS12_add_safes - Create and add objects to a PKCS#12 structure
  4. =head1 SYNOPSIS
  5. #include <openssl/pkcs12.h>
  6. int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
  7. int safe_nid, int iter, const char *pass);
  8. PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
  9. =head1 DESCRIPTION
  10. PKCS12_add_safe() creates a new PKCS7 contentInfo containing the supplied
  11. B<PKCS12_SAFEBAG>s and adds this to a set of PKCS7 contentInfos. Its type
  12. depends on the value of B<safe_nid>:
  13. =over 4
  14. =item * If I<safe_nid> is -1, a plain PKCS7 I<data> contentInfo is created.
  15. =item * If I<safe_nid> is a valid PBE algorithm NID, a PKCS7 B<encryptedData>
  16. contentInfo is created. The algorithm uses I<pass> as the passphrase and I<iter>
  17. as the iteration count. If I<iter> is zero then a default value for iteration
  18. count of 2048 is used.
  19. =item * If I<safe_nid> is 0, a PKCS7 B<encryptedData> contentInfo is created using
  20. a default encryption algorithm, currently B<NID_pbe_WithSHA1And3_Key_TripleDES_CBC>.
  21. =back
  22. PKCS12_add_safes() creates a B<PKCS12> structure containing the supplied set of
  23. PKCS7 contentInfos. The I<safes> are enclosed first within a PKCS7 contentInfo
  24. of type I<p7_nid>. Currently the only supported type is B<NID_pkcs7_data>.
  25. =head1 NOTES
  26. PKCS12_add_safe() makes assumptions regarding the encoding of the given pass
  27. phrase.
  28. See L<passphrase-encoding(7)> for more information.
  29. =head1 RETURN VALUES
  30. PKCS12_add_safe() returns a value of 1 indicating success or 0 for failure.
  31. PKCS12_add_safes() returns a valid B<PKCS12> structure or NULL if an error occurred.
  32. =head1 SEE ALSO
  33. L<PKCS12_create(3)>
  34. =head1 COPYRIGHT
  35. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  36. Licensed under the Apache License 2.0 (the "License"). You may not use
  37. this file except in compliance with the License. You can obtain a copy
  38. in the file LICENSE in the source distribution or at
  39. L<https://www.openssl.org/source/license.html>.
  40. =cut