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