1.Dd $Mdocdate: November 11 2015 $ 2.Dt CMS_ADD0_CERT 3 3.Os 4.Sh NAME 5.Nm CMS_add0_cert , 6.Nm CMS_add1_cert , 7.Nm CMS_get1_certs , 8.Nm CMS_add0_crl , 9.Nm CMS_add1_crl , 10.Nm CMS_get1_crls 11.Nd CMS certificate and CRL utility functions 12.Sh SYNOPSIS 13.In openssl/cms.h 14.Ft int 15.Fo CMS_add0_cert 16.Fa "CMS_ContentInfo *cms" 17.Fa "X509 *cert" 18.Fc 19.Ft int 20.Fo CMS_add1_cert 21.Fa "CMS_ContentInfo *cms" 22.Fa "X509 *cert" 23.Fc 24.Ft STACK_OF(X509) * 25.Fo CMS_get1_certs 26.Fa "CMS_ContentInfo *cms" 27.Fc 28.Ft int 29.Fo CMS_add0_crl 30.Fa "CMS_ContentInfo *cms" 31.Fa "X509_CRL *crl" 32.Fc 33.Ft int 34.Fo CMS_add1_crl 35.Fa "CMS_ContentInfo *cms" 36.Fa "X509_CRL *crl" 37.Fc 38.Ft STACK_OF(X509_CRL) * 39.Fo CMS_get1_crls 40.Fa "CMS_ContentInfo *cms" 41.Fc 42.Sh DESCRIPTION 43.Fn CMS_add0_cert 44and 45.Fn CMS_add1_cert 46add certificate 47.Fa cert 48to 49.Fa cms . 50.Fa cms 51must be of type signed data or enveloped data. 52.Pp 53.Fn CMS_get1_certs 54returns all certificates in 55.Fa cms . 56.Pp 57.Fn CMS_add0_crl 58and 59.Fn CMS_add1_crl 60add CRL 61.Fa crl 62to 63.Fa cms . 64.Fn CMS_get1_crls 65returns any CRLs in 66.Fa cms . 67.Sh NOTES 68The 69.Vt CMS_ContentInfo 70structure 71.Fa cms 72must be of type signed data or enveloped data or an error will be 73returned. 74.Pp 75For signed data, certificates and CRLs are added to the 76.Fa certificates 77and 78.Fa crls 79fields of the SignedData structure. 80For enveloped data, they are added to 81.Fa OriginatorInfo . 82.Pp 83As the 84.Sq 0 85implies, 86.Fn CMS_add0_cert 87adds 88.Fa cert 89internally to 90.Fa cms 91and it must not be freed up after the call, as opposed to 92.Fn CMS_add1_cert 93where 94.Fa cert 95must be freed up. 96.Pp 97The same certificate or CRL must not be added to the same cms structure 98more than once. 99.Sh RETURN VALUES 100.Fn CMS_add0_cert , 101.Fn CMS_add1_cert , 102.Fn CMS_add0_crl , 103and 104.Fn CMS_add1_crl 105return 1 for success and 0 for failure. 106.Pp 107.Fn CMS_get1_certs 108and 109.Fn CMS_get1_crls 110return the STACK of certificates or CRLs or 111.Dv NULL 112if there are none or an error occurs. 113The only error which will occur in practice is if the 114.Fa cms 115type is invalid. 116.Sh SEE ALSO 117.Xr CMS_encrypt 3 , 118.Xr CMS_sign 3 , 119.Xr ERR_get_error 3 120.Sh HISTORY 121.Fn CMS_add0_cert , 122.Fn CMS_add1_cert , 123.Fn CMS_get1_certs , 124.Fn CMS_add0_crl 125and 126.Fn CMS_get1_crls 127were all first added to OpenSSL 0.9.8. 128