| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "CMS_ADD1_SIGNER 3SSL" |
| 58 |
.TH CMS_ADD1_SIGNER 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
CMS_add1_signer, CMS_SignerInfo_sign \- add a signer to a CMS_ContentInfo signed data structure |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& #include <openssl/cms.h> |
| 69 |
\& |
| 70 |
\& CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signcert, |
| 71 |
\& EVP_PKEY *pkey, const EVP_MD *md, |
| 72 |
\& unsigned int flags); |
| 73 |
\& |
| 74 |
\& int CMS_SignerInfo_sign(CMS_SignerInfo *si); |
| 75 |
.Ve |
| 76 |
.SH DESCRIPTION |
| 77 |
.IX Header "DESCRIPTION" |
| 78 |
\&\fBCMS_add1_signer()\fR adds a signer with certificate \fBsigncert\fR and private |
| 79 |
key \fBpkey\fR using message digest \fBmd\fR to CMS_ContentInfo SignedData |
| 80 |
structure \fBcms\fR. |
| 81 |
.PP |
| 82 |
The CMS_ContentInfo structure should be obtained from an initial call to |
| 83 |
\&\fBCMS_sign()\fR with the flag \fBCMS_PARTIAL\fR set or in the case or re-signing a |
| 84 |
valid CMS_ContentInfo SignedData structure. |
| 85 |
.PP |
| 86 |
If the \fBmd\fR parameter is \fBNULL\fR then the default digest for the public |
| 87 |
key algorithm will be used. |
| 88 |
.PP |
| 89 |
Unless the \fBCMS_REUSE_DIGEST\fR flag is set the returned CMS_ContentInfo |
| 90 |
structure is not complete and must be finalized either by streaming (if |
| 91 |
applicable) or a call to \fBCMS_final()\fR. |
| 92 |
.PP |
| 93 |
The \fBCMS_SignerInfo_sign()\fR function explicitly signs a CMS_SignerInfo |
| 94 |
structure, its main use is when the \fBCMS_REUSE_DIGEST\fR and \fBCMS_PARTIAL\fR flags |
| 95 |
are both set. |
| 96 |
.SH NOTES |
| 97 |
.IX Header "NOTES" |
| 98 |
The main purpose of \fBCMS_add1_signer()\fR is to provide finer control |
| 99 |
over a CMS signed data structure where the simpler \fBCMS_sign()\fR function defaults |
| 100 |
are not appropriate. For example if multiple signers or non default digest |
| 101 |
algorithms are needed. New attributes can also be added using the returned |
| 102 |
CMS_SignerInfo structure and the CMS attribute utility functions or the |
| 103 |
CMS signed receipt request functions. |
| 104 |
.PP |
| 105 |
Any of the following flags (ored together) can be passed in the \fBflags\fR |
| 106 |
parameter. |
| 107 |
.PP |
| 108 |
If \fBCMS_REUSE_DIGEST\fR is set then an attempt is made to copy the content |
| 109 |
digest value from the CMS_ContentInfo structure: to add a signer to an existing |
| 110 |
structure. An error occurs if a matching digest value cannot be found to copy. |
| 111 |
The returned CMS_ContentInfo structure will be valid and finalized when this |
| 112 |
flag is set. |
| 113 |
.PP |
| 114 |
If \fBCMS_PARTIAL\fR is set in addition to \fBCMS_REUSE_DIGEST\fR then the |
| 115 |
CMS_SignerInfo structure will not be finalized so additional attributes |
| 116 |
can be added. In this case an explicit call to \fBCMS_SignerInfo_sign()\fR is |
| 117 |
needed to finalize it. |
| 118 |
.PP |
| 119 |
If \fBCMS_NOCERTS\fR is set the signer's certificate will not be included in the |
| 120 |
CMS_ContentInfo structure, the signer's certificate must still be supplied in |
| 121 |
the \fBsigncert\fR parameter though. This can reduce the size of the signature if |
| 122 |
the signers certificate can be obtained by other means: for example a |
| 123 |
previously signed message. |
| 124 |
.PP |
| 125 |
The SignedData structure includes several CMS signedAttributes including the |
| 126 |
signing time, the CMS content type and the supported list of ciphers in an |
| 127 |
SMIMECapabilities attribute. If \fBCMS_NOATTR\fR is set then no signedAttributes |
| 128 |
will be used at all. If \fBCMS_NOSMIMECAP\fR is set then the SMIMECapabilities |
| 129 |
will be omitted. If \fBCMS_NO_SIGNING_TIME\fR is set then the signing time will be |
| 130 |
omitted. |
| 131 |
.PP |
| 132 |
OpenSSL will by default identify signing certificates using issuer name |
| 133 |
and serial number. If \fBCMS_USE_KEYID\fR is set it will use the subject key |
| 134 |
identifier value instead. An error occurs if the signing certificate does not |
| 135 |
have a subject key identifier extension. |
| 136 |
.PP |
| 137 |
If present the SMIMECapabilities attribute indicates support for the following |
| 138 |
algorithms in preference order: 256 bit AES, Gost R3411\-94, Gost 28147\-89, 192 |
| 139 |
bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. |
| 140 |
If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is |
| 141 |
not loaded. |
| 142 |
.PP |
| 143 |
\&\fBCMS_add1_signer()\fR returns an internal pointer to the CMS_SignerInfo |
| 144 |
structure just added, this can be used to set additional attributes |
| 145 |
before it is finalized. |
| 146 |
.SH "RETURN VALUES" |
| 147 |
.IX Header "RETURN VALUES" |
| 148 |
\&\fBCMS_add1_signer()\fR returns an internal pointer to the CMS_SignerInfo |
| 149 |
structure just added or NULL if an error occurs. |
| 150 |
.PP |
| 151 |
\&\fBCMS_SignerInfo_sign()\fR returns 1 on success, 0 on failure. |
| 152 |
.SH "SEE ALSO" |
| 153 |
.IX Header "SEE ALSO" |
| 154 |
\&\fBERR_get_error\fR\|(3), \fBCMS_sign\fR\|(3), |
| 155 |
\&\fBCMS_final\fR\|(3), |
| 156 |
.SH COPYRIGHT |
| 157 |
.IX Header "COPYRIGHT" |
| 158 |
Copyright 2014\-2016 The OpenSSL Project Authors. All Rights Reserved. |
| 159 |
.PP |
| 160 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 161 |
this file except in compliance with the License. You can obtain a copy |
| 162 |
in the file LICENSE in the source distribution or at |
| 163 |
<https://www.openssl.org/source/license.html>. |