PKCS12_SAFEBAG_create_cert.pod 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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,
  6. PKCS12_SAFEBAG_create_pkcs8_encrypt_ex - Create 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. PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,
  23. const char *pass,
  24. int passlen,
  25. unsigned char *salt,
  26. int saltlen, int iter,
  27. PKCS8_PRIV_KEY_INFO *p8inf,
  28. OSSL_LIB_CTX *ctx,
  29. const char *propq);
  30. =head1 DESCRIPTION
  31. PKCS12_SAFEBAG_create_cert() creates a new B<PKCS12_SAFEBAG> of type B<NID_certBag>
  32. containing the supplied certificate.
  33. PKCS12_SAFEBAG_create_crl() creates a new B<PKCS12_SAFEBAG> of type B<NID_crlBag>
  34. containing the supplied crl.
  35. PKCS12_SAFEBAG_create_secret() creates a new B<PKCS12_SAFEBAG> of type
  36. corresponding to a PKCS#12 B<secretBag>. The B<secretBag> contents are tagged as
  37. I<type> with an ASN1 value of type I<vtype> constructed using the bytes in
  38. I<value> of length I<len>.
  39. PKCS12_SAFEBAG_create0_p8inf() creates a new B<PKCS12_SAFEBAG> of type B<NID_keyBag>
  40. containing the supplied PKCS8 structure.
  41. PKCS12_SAFEBAG_create0_pkcs8() creates a new B<PKCS12_SAFEBAG> of type
  42. B<NID_pkcs8ShroudedKeyBag> containing the supplied PKCS8 structure.
  43. PKCS12_SAFEBAG_create_pkcs8_encrypt() creates a new B<PKCS12_SAFEBAG> of type
  44. B<NID_pkcs8ShroudedKeyBag> by encrypting the supplied PKCS8 I<p8inf>.
  45. If I<pbe_nid> is 0, a default encryption algorithm is used. I<pass> is the
  46. passphrase and I<iter> is the iteration count. If I<iter> is zero then a default
  47. value of 2048 is used. If I<salt> is NULL then a salt is generated randomly.
  48. PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() is identical to PKCS12_SAFEBAG_create_pkcs8_encrypt()
  49. but allows for a library context I<ctx> and property query I<propq> to be used to select
  50. algorithm implementations.
  51. =head1 NOTES
  52. PKCS12_SAFEBAG_create_pkcs8_encrypt() makes assumptions regarding the encoding of the given pass
  53. phrase.
  54. See L<passphrase-encoding(7)> for more information.
  55. PKCS12_SAFEBAG_create_secret() was added in OpenSSL 3.0.
  56. =head1 RETURN VALUES
  57. All of these functions return a valid B<PKCS12_SAFEBAG> structure or NULL if an error occurred.
  58. =head1 CONFORMING TO
  59. IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
  60. =head1 SEE ALSO
  61. L<PKCS12_create(3)>,
  62. L<PKCS12_add_safe(3)>,
  63. L<PKCS12_add_safes(3)>
  64. =head1 HISTORY
  65. PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() was added in OpenSSL 3.0.
  66. =head1 COPYRIGHT
  67. Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
  68. Licensed under the Apache License 2.0 (the "License"). You may not use
  69. this file except in compliance with the License. You can obtain a copy
  70. in the file LICENSE in the source distribution or at
  71. L<https://www.openssl.org/source/license.html>.
  72. =cut