PKCS12_SAFEBAG_create_cert.pod 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. =pod
  2. =head1 NAME
  3. PKCS12_SAFEBAG_create_cert, PKCS12_SAFEBAG_create_crl,
  4. PKCS12_SAFEBAG_create_secret, PKCS12_SAFEBAG_create0_p8inf,
  5. PKCS12_SAFEBAG_create0_pkcs8, PKCS12_SAFEBAG_create_pkcs8_encrypt - Create
  6. PKCS#12 safeBag objects
  7. =head1 SYNOPSIS
  8. #include <openssl/pkcs12.h>
  9. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
  10. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
  11. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype,
  12. const unsigned char* value,
  13. int len);
  14. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
  15. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
  16. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
  17. const char *pass,
  18. int passlen,
  19. unsigned char *salt,
  20. int saltlen, int iter,
  21. PKCS8_PRIV_KEY_INFO *p8inf);
  22. =head1 DESCRIPTION
  23. PKCS12_SAFEBAG_create_cert() creates a new B<PKCS12_SAFEBAG> of type B<NID_certBag>
  24. containing the supplied certificate.
  25. PKCS12_SAFEBAG_create_crl() creates a new B<PKCS12_SAFEBAG> of type B<NID_crlBag>
  26. containing the supplied crl.
  27. PKCS12_SAFEBAG_create_secret() creates a new B<PKCS12_SAFEBAG> of type
  28. corresponding to a PKCS#12 I<secretBag>. The I<secretBag> contents are tagged as
  29. I<type> with an ASN1 value of type I<vtype> constructed using the bytes in
  30. I<value> of length I<len>.
  31. PKCS12_SAFEBAG_create0_p8inf() creates a new B<PKCS12_SAFEBAG> of type B<NID_keyBag>
  32. containing the supplied PKCS8 structure.
  33. PKCS12_SAFEBAG_create0_pkcs8() creates a new B<PKCS12_SAFEBAG> of type
  34. B<NID_pkcs8ShroudedKeyBag> containing the supplied PKCS8 structure.
  35. PKCS12_SAFEBAG_create_pkcs8_encrypt() creates a new B<PKCS12_SAFEBAG> of type
  36. B<NID_pkcs8ShroudedKeyBag> by encrypting the supplied PKCS8 I<p8inf>.
  37. If I<pbe_nid> is 0, a default encryption algorithm is used. I<pass> is the
  38. passphrase and I<iter> is the iteration count. If I<iter> is zero then a default
  39. value of 2048 is used. If I<salt> is NULL then a salt is generated randomly.
  40. =head1 NOTES
  41. PKCS12_SAFEBAG_create_pkcs8_encrypt() makes assumptions regarding the encoding of the given pass
  42. phrase.
  43. See L<passphrase-encoding(7)> for more information.
  44. PKCS12_SAFEBAG_create_secret() was added in OpenSSL 3.0.
  45. =head1 RETURN VALUES
  46. All of these functions return a valid B<PKCS12_SAFEBAG> structure or NULL if an error occurred.
  47. =head1 SEE ALSO
  48. L<PKCS12_create(3)>,
  49. L<PKCS12_add_safe(3)>,
  50. L<PKCS12_add_safes(3)>
  51. =head1 COPYRIGHT
  52. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  53. Licensed under the Apache License 2.0 (the "License"). You may not use
  54. this file except in compliance with the License. You can obtain a copy
  55. in the file LICENSE in the source distribution or at
  56. L<https://www.openssl.org/source/license.html>.
  57. =cut