1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimCMS_SignerInfo_set1_signer_cert, 6e71b7053SJung-uk KimCMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, 7e71b7053SJung-uk KimCMS_SignerInfo_get0_signature, CMS_SignerInfo_cert_cmp 8e71b7053SJung-uk Kim- CMS signedData signer functions 9e71b7053SJung-uk Kim 10e71b7053SJung-uk Kim=head1 SYNOPSIS 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim #include <openssl/cms.h> 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, 17e71b7053SJung-uk Kim X509_NAME **issuer, ASN1_INTEGER **sno); 18e71b7053SJung-uk Kim ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); 19e71b7053SJung-uk Kim int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); 20e71b7053SJung-uk Kim void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); 21e71b7053SJung-uk Kim 22e71b7053SJung-uk Kim=head1 DESCRIPTION 23e71b7053SJung-uk Kim 24e71b7053SJung-uk KimThe function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structures 25e71b7053SJung-uk Kimassociated with a CMS signedData structure. 26e71b7053SJung-uk Kim 27e71b7053SJung-uk KimCMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier 28e71b7053SJung-uk Kimassociated with a specific CMS_SignerInfo structure B<si>. Either the 29e71b7053SJung-uk Kimkeyidentifier will be set in B<keyid> or B<both> issuer name and serial number 30e71b7053SJung-uk Kimin B<issuer> and B<sno>. 31e71b7053SJung-uk Kim 32e71b7053SJung-uk KimCMS_SignerInfo_get0_signature() retrieves the signature associated with 33e71b7053SJung-uk KimB<si> in a pointer to an ASN1_OCTET_STRING structure. This pointer returned 34e71b7053SJung-uk Kimcorresponds to the internal signature value if B<si> so it may be read or 35e71b7053SJung-uk Kimmodified. 36e71b7053SJung-uk Kim 37e71b7053SJung-uk KimCMS_SignerInfo_cert_cmp() compares the certificate B<cert> against the signer 38e71b7053SJung-uk Kimidentifier B<si>. It returns zero if the comparison is successful and non zero 39e71b7053SJung-uk Kimif not. 40e71b7053SJung-uk Kim 41e71b7053SJung-uk KimCMS_SignerInfo_set1_signer_cert() sets the signers certificate of B<si> to 42e71b7053SJung-uk KimB<signer>. 43e71b7053SJung-uk Kim 44e71b7053SJung-uk Kim=head1 NOTES 45e71b7053SJung-uk Kim 46e71b7053SJung-uk KimThe main purpose of these functions is to enable an application to lookup 47e71b7053SJung-uk Kimsigners certificates using any appropriate technique when the simpler method 48e71b7053SJung-uk Kimof CMS_verify() is not appropriate. 49e71b7053SJung-uk Kim 50e71b7053SJung-uk KimIn typical usage and application will retrieve all CMS_SignerInfo structures 51e71b7053SJung-uk Kimusing CMS_get0_SignerInfo() and retrieve the identifier information using 52e71b7053SJung-uk KimCMS. It will then obtain the signer certificate by some unspecified means 53e71b7053SJung-uk Kim(or return and error if it cannot be found) and set it using 54e71b7053SJung-uk KimCMS_SignerInfo_set1_signer_cert(). 55e71b7053SJung-uk Kim 56e71b7053SJung-uk KimOnce all signer certificates have been set CMS_verify() can be used. 57e71b7053SJung-uk Kim 58e71b7053SJung-uk KimAlthough CMS_get0_SignerInfos() can return NULL if an error occurs B<or> if 59e71b7053SJung-uk Kimthere are no signers this is not a problem in practice because the only 60e71b7053SJung-uk Kimerror which can occur is if the B<cms> structure is not of type signedData 61e71b7053SJung-uk Kimdue to application error. 62e71b7053SJung-uk Kim 63e71b7053SJung-uk Kim=head1 RETURN VALUES 64e71b7053SJung-uk Kim 65e71b7053SJung-uk KimCMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there 66e71b7053SJung-uk Kimare no signers or an error occurs. 67e71b7053SJung-uk Kim 68e71b7053SJung-uk KimCMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure. 69e71b7053SJung-uk Kim 70e71b7053SJung-uk KimCMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non 71e71b7053SJung-uk Kimzero otherwise. 72e71b7053SJung-uk Kim 73e71b7053SJung-uk KimCMS_SignerInfo_set1_signer_cert() does not return a value. 74e71b7053SJung-uk Kim 75e71b7053SJung-uk KimAny error can be obtained from L<ERR_get_error(3)> 76e71b7053SJung-uk Kim 77e71b7053SJung-uk Kim=head1 SEE ALSO 78e71b7053SJung-uk Kim 79e71b7053SJung-uk KimL<ERR_get_error(3)>, L<CMS_verify(3)> 80e71b7053SJung-uk Kim 81e71b7053SJung-uk Kim=head1 COPYRIGHT 82e71b7053SJung-uk Kim 83e71b7053SJung-uk KimCopyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved. 84e71b7053SJung-uk Kim 85*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 86e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 87e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 88e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 89e71b7053SJung-uk Kim 90e71b7053SJung-uk Kim=cut 91