CMS_add0_cert.pod 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. =pod
  2. =head1 NAME
  3. CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_add1_crl, CMS_get1_crls
  4. - CMS certificate and CRL utility functions
  5. =head1 SYNOPSIS
  6. #include <openssl/cms.h>
  7. int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
  8. int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
  9. STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
  10. int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
  11. int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
  12. STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
  13. =head1 DESCRIPTION
  14. CMS_add0_cert() and CMS_add1_cert() add certificate I<cert> to I<cms>.
  15. I<cms> must be of type signed data or (authenticated) enveloped data.
  16. For signed data, such a certificate can be used when signing or verifying
  17. to fill in the signer certificate or to provide an extra CA certificate
  18. that may be needed for chain building in certificate validation.
  19. CMS_get1_certs() returns all certificates in I<cms>.
  20. CMS_add0_crl() and CMS_add1_crl() add CRL I<crl> to I<cms>.
  21. I<cms> must be of type signed data or (authenticated) enveloped data.
  22. For signed data, such a CRL may be used in certificate validation.
  23. It may be given both for inclusion when signing a CMS message
  24. and when verifying a signed CMS message.
  25. CMS_get1_crls() returns all CRLs in I<cms>.
  26. =head1 NOTES
  27. The CMS_ContentInfo structure I<cms> must be of type signed data or enveloped
  28. data or an error will be returned.
  29. For signed data certificates and CRLs are added to the I<certificates> and
  30. I<crls> fields of SignedData structure. For enveloped data they are added to
  31. B<OriginatorInfo>.
  32. As the I<0> implies CMS_add0_cert() adds I<cert> internally to I<cms> and it
  33. must not be freed up after the call as opposed to CMS_add1_cert() where I<cert>
  34. must be freed up.
  35. The same certificate or CRL must not be added to the same cms structure more
  36. than once.
  37. =head1 RETURN VALUES
  38. CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return
  39. 1 for success and 0 for failure.
  40. CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs
  41. or NULL if there are none or an error occurs. The only error which will occur
  42. in practice is if the I<cms> type is invalid.
  43. =head1 SEE ALSO
  44. L<ERR_get_error(3)>,
  45. L<CMS_sign(3)>,
  46. L<CMS_encrypt(3)>
  47. =head1 COPYRIGHT
  48. Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.
  49. Licensed under the OpenSSL license (the "License"). You may not use
  50. this file except in compliance with the License. You can obtain a copy
  51. in the file LICENSE in the source distribution or at
  52. L<https://www.openssl.org/source/license.html>.
  53. =cut