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