1PKCS7_SIGN_ADD_SIGNER(3ossl)        OpenSSL       PKCS7_SIGN_ADD_SIGNER(3ossl)
2
3
4

NAME

6       PKCS7_sign_add_signer, PKCS7_add_certificate, PKCS7_add_crl - add
7       information to PKCS7 structure
8

SYNOPSIS

10        #include <openssl/pkcs7.h>
11
12        PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,
13                                                 EVP_PKEY *pkey, const EVP_MD *md, int flags);
14        int PKCS7_add_certificate(PKCS7 *p7, X509 *cert);
15        int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl);
16

DESCRIPTION

18       PKCS7_sign_add_signer() adds a signer with certificate signcert and
19       private key pkey using message digest md to a PKCS7 signed data
20       structure p7.
21
22       The PKCS7 structure should be obtained from an initial call to
23       PKCS7_sign() with the flag PKCS7_PARTIAL set or in the case or re-
24       signing a valid PKCS#7 signed data structure.
25
26       If the md parameter is NULL then the default digest for the public key
27       algorithm will be used.
28
29       Unless the PKCS7_REUSE_DIGEST flag is set the returned PKCS7 structure
30       is not complete and must be finalized either by streaming (if
31       applicable) or a call to PKCS7_final().
32

NOTES

34       The main purpose of this function is to provide finer control over a
35       PKCS#7 signed data structure where the simpler PKCS7_sign() function
36       defaults are not appropriate. For example if multiple signers or non
37       default digest algorithms are needed.
38
39       Any of the following flags (ored together) can be passed in the flags
40       parameter.
41
42       If PKCS7_REUSE_DIGEST is set then an attempt is made to copy the
43       content digest value from the PKCS7 structure: to add a signer to an
44       existing structure.  An error occurs if a matching digest value cannot
45       be found to copy. The returned PKCS7 structure will be valid and
46       finalized when this flag is set.
47
48       If PKCS7_PARTIAL is set in addition to PKCS7_REUSE_DIGEST then the
49       PKCS7_SIGNER_INO structure will not be finalized so additional
50       attributes can be added. In this case an explicit call to
51       PKCS7_SIGNER_INFO_sign() is needed to finalize it.
52
53       If PKCS7_NOCERTS is set the signer's certificate will not be included
54       in the PKCS7 structure, the signer's certificate must still be supplied
55       in the signcert parameter though. This can reduce the size of the
56       signature if the signers certificate can be obtained by other means:
57       for example a previously signed message.
58
59       The signedData structure includes several PKCS#7
60       authenticatedAttributes including the signing time, the PKCS#7 content
61       type and the supported list of ciphers in an SMIMECapabilities
62       attribute. If PKCS7_NOATTR is set then no authenticatedAttributes will
63       be used. If PKCS7_NOSMIMECAP is set then just the SMIMECapabilities are
64       omitted.
65
66       If present the SMIMECapabilities attribute indicates support for the
67       following algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40
68       bit RC2. If any of these algorithms is disabled then it will not be
69       included.
70
71       PKCS7_sign_add_signers() returns an internal pointer to the
72       PKCS7_SIGNER_INFO structure just added, which can be used to set
73       additional attributes before it is finalized.
74
75       PKCS7_add_certificate() adds to the PKCS7 structure p7 the certificate
76       cert, which may be an end-entity (signer) certificate or a CA
77       certificate useful for chain building.  This is done internally by
78       PKCS7_sign_ex(3) and similar signing functions.  It may have to be used
79       before calling PKCS7_verify(3) in order to provide any missing
80       certificate(s) needed for verification.
81
82       PKCS7_add_crl() adds the CRL crl to the PKCS7 structure p7.  This may
83       be called to provide certificate status information to be included when
84       signing or to use when verifying the PKCS7 structure.
85

RETURN VALUES

87       PKCS7_sign_add_signers() returns an internal pointer to the
88       PKCS7_SIGNER_INFO structure just added or NULL if an error occurs.
89
90       PKCS7_add_certificate() and PKCS7_add_crl() return 1 on success, 0 on
91       error.
92

SEE ALSO

94       ERR_get_error(3), PKCS7_sign_ex(3), PKCS7_final(3), PKCS7_verify(3)
95

HISTORY

97       The PPKCS7_sign_add_signer() function was added in OpenSSL 1.0.0.
98
100       Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.
101
102       Licensed under the Apache License 2.0 (the "License").  You may not use
103       this file except in compliance with the License.  You can obtain a copy
104       in the file LICENSE in the source distribution or at
105       <https://www.openssl.org/source/license.html>.
106
107
108
1093.0.9                             2023-07-27      PKCS7_SIGN_ADD_SIGNER(3ossl)
Impressum