1=pod
2
3=head1 NAME
4
5OSSL_ESS_signing_cert_new_init,
6OSSL_ESS_signing_cert_v2_new_init,
7OSSL_ESS_check_signing_certs
8- Enhanced Security Services (ESS) functions
9
10=head1 SYNOPSIS
11
12 #include <openssl/ess.h>
13
14 ESS_SIGNING_CERT *OSSL_ESS_signing_cert_new_init(const X509 *signcert,
15                                                  const STACK_OF(X509) *certs,
16                                                  int set_issuer_serial);
17 ESS_SIGNING_CERT_V2 *OSSL_ESS_signing_cert_v2_new_init(const EVP_MD *hash_alg,
18                                                        const X509 *signcert,
19                                                        const
20                                                        STACK_OF(X509) *certs,
21                                                        int set_issuer_serial);
22 int OSSL_ESS_check_signing_certs(const ESS_SIGNING_CERT *ss,
23                                  const ESS_SIGNING_CERT_V2 *ssv2,
24                                  const STACK_OF(X509) *chain,
25                                  int require_signing_cert);
26
27=head1 DESCRIPTION
28
29OSSL_ESS_signing_cert_new_init() generates a new B<ESS_SIGNING_CERT> structure
30referencing the given I<signcert> and any given further I<certs>
31using their SHA-1 fingerprints.
32If I<set_issuer_serial> is nonzero then also the issuer and serial number
33of I<signcert> are included in the B<ESS_CERT_ID> as the B<issuerSerial> field.
34For all members of I<certs> the  B<issuerSerial> field is always included.
35
36OSSL_ESS_signing_cert_v2_new_init() is the same as
37OSSL_ESS_signing_cert_new_init() except that it uses the given I<hash_alg> and
38generates a B<ESS_SIGNING_CERT_V2> structure with B<ESS_CERT_ID_V2> elements.
39
40OSSL_ESS_check_signing_certs() checks if the validation chain I<chain> contains
41the certificates required by the identifiers given in I<ss> and/or I<ssv2>.
42If I<require_signing_cert> is nonzero, I<ss> or I<ssv2> must not be NULL.
43If both I<ss> and I<ssv2> are not NULL, they are evaluated independently.
44The list of certificate identifiers in I<ss> is of type B<ESS_CERT_ID>,
45while the list contained in I<ssv2> is of type B<ESS_CERT_ID_V2>.
46As far as these lists are present, they must be nonempty.
47The certificate identified by their first entry must be the first element of
48I<chain>, i.e. the signer certificate.
49Any further certificates referenced in the list must also be found in I<chain>.
50The matching is done using the given certificate hash algorithm and value.
51In addition to the checks required by RFCs 2624 and 5035,
52if the B<issuerSerial> field is included in an B<ESSCertID> or B<ESSCertIDv2>
53it must match the certificate issuer and serial number attributes.
54
55=head1 NOTES
56
57ESS has been defined in RFC 2634, which has been updated in RFC 5035
58(ESS version 2) to support hash algorithms other than SHA-1.
59This is used for TSP (RFC 3161) and CAdES-BES (informational RFC 5126).
60
61=head1 RETURN VALUES
62
63OSSL_ESS_signing_cert_new_init() and OSSL_ESS_signing_cert_v2_new_init()
64return a pointer to the new structure or NULL on malloc failure.
65
66OSSL_ESS_check_signing_certs() returns 1 on success,
670 if a required certificate cannot be found, -1 on other error.
68
69=head1 SEE ALSO
70
71L<TS_VERIFY_CTX_set_certs(3)>,
72L<CMS_verify(3)>
73
74=head1 HISTORY
75
76OSSL_ESS_signing_cert_new_init(), OSSL_ESS_signing_cert_v2_new_init(), and
77OSSL_ESS_check_signing_certs() were added in OpenSSL 3.0.
78
79=head1 COPYRIGHT
80
81Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.
82
83Licensed under the Apache License 2.0 (the "License").  You may not use
84this file except in compliance with the License.  You can obtain a copy
85in the file LICENSE in the source distribution or at
86L<https://www.openssl.org/source/license.html>.
87
88=cut
89