1CMS_add1_signer(3) OpenSSL CMS_add1_signer(3)
2
3
4
6 CMS_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_ContentInfo signed data structure.
7
9 #include <openssl/cms.h>
10
11 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, unsigned int flags);
12
13 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
14
16 CMS_add1_signer() adds a signer with certificate signcert and private
17 key pkey using message digest md to CMS_ContentInfo SignedData
18 structure cms.
19
20 The CMS_ContentInfo structure should be obtained from an initial call
21 to CMS_sign() with the flag CMS_PARTIAL set or in the case or re-
22 signing a valid CMS_ContentInfo SignedData structure.
23
24 If the md parameter is NULL then the default digest for the public key
25 algorithm will be used.
26
27 Unless the CMS_REUSE_DIGEST flag is set the returned CMS_ContentInfo
28 structure is not complete and must be finalized either by streaming (if
29 applicable) or a call to CMS_final().
30
31 The CMS_SignerInfo_sign() function will explicitly sign a
32 CMS_SignerInfo structure, its main use is when CMS_REUSE_DIGEST and
33 CMS_PARTIAL flags are both set.
34
36 The main purpose of CMS_add1_signer() is to provide finer control over
37 a CMS signed data structure where the simpler CMS_sign() function
38 defaults are not appropriate. For example if multiple signers or non
39 default digest algorithms are needed. New attributes can also be added
40 using the returned CMS_SignerInfo structure and the CMS attribute
41 utility functions or the CMS signed receipt request functions.
42
43 Any of the following flags (ored together) can be passed in the flags
44 parameter.
45
46 If CMS_REUSE_DIGEST is set then an attempt is made to copy the content
47 digest value from the CMS_ContentInfo structure: to add a signer to an
48 existing structure. An error occurs if a matching digest value cannot
49 be found to copy. The returned CMS_ContentInfo structure will be valid
50 and finalized when this flag is set.
51
52 If CMS_PARTIAL is set in addition to CMS_REUSE_DIGEST then the
53 CMS_SignerInfo structure will not be finalized so additional attributes
54 can be added. In this case an explicit call to CMS_SignerInfo_sign() is
55 needed to finalize it.
56
57 If CMS_NOCERTS is set the signer's certificate will not be included in
58 the CMS_ContentInfo structure, the signer's certificate must still be
59 supplied in the signcert parameter though. This can reduce the size of
60 the signature if the signers certificate can be obtained by other
61 means: for example a previously signed message.
62
63 The SignedData structure includes several CMS signedAttributes
64 including the signing time, the CMS content type and the supported list
65 of ciphers in an SMIMECapabilities attribute. If CMS_NOATTR is set then
66 no signedAttributes will be used. If CMS_NOSMIMECAP is set then just
67 the SMIMECapabilities are omitted.
68
69 OpenSSL will by default identify signing certificates using issuer name
70 and serial number. If CMS_USE_KEYID is set it will use the subject key
71 identifier value instead. An error occurs if the signing certificate
72 does not have a subject key identifier extension.
73
74 If present the SMIMECapabilities attribute indicates support for the
75 following algorithms in preference order: 256 bit AES, Gost R3411-94,
76 Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64
77 bit RC2, DES and 40 bit RC2. If any of these algorithms is not
78 available then it will not be included: for example the GOST algorithms
79 will not be included if the GOST ENGINE is not loaded.
80
81 CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo
82 structure just added, this can be used to set additional attributes
83 before it is finalized.
84
86 CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo
87 structure just added or NULL if an error occurs.
88
90 ERR_get_error(3), CMS_sign(3), CMS_final(3),
91
93 CMS_add1_signer() was added to OpenSSL 0.9.8
94
95
96
971.0.2o 2020-08-01 CMS_add1_signer(3)