crypto/cms: Add support for CAdES Basic Electronic Signatures (CAdES-BES)
[openssl.git] / crypto / include / internal / ess_int.h
1 /*
2  * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 /* internal ESS related stuff */
11
12 ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si);
13 int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc);
14
15 ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_get(PKCS7_SIGNER_INFO *si);
16 int ESS_SIGNING_CERT_V2_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT_V2 *sc);
17
18 /*-
19  * IssuerSerial ::= SEQUENCE {
20  *        issuer                  GeneralNames,
21  *        serialNumber            CertificateSerialNumber
22  * }
23  */
24
25 struct ESS_issuer_serial {
26     STACK_OF(GENERAL_NAME) *issuer;
27     ASN1_INTEGER *serial;
28 };
29
30 /*-
31  * ESSCertID ::=  SEQUENCE {
32  *        certHash                Hash,
33  *        issuerSerial            IssuerSerial OPTIONAL
34  * }
35  */
36
37 struct ESS_cert_id {
38     ASN1_OCTET_STRING *hash;    /* Always SHA-1 digest. */
39     ESS_ISSUER_SERIAL *issuer_serial;
40 };
41
42 /*-
43  * SigningCertificate ::=  SEQUENCE {
44  *        certs                   SEQUENCE OF ESSCertID,
45  *        policies                SEQUENCE OF PolicyInformation OPTIONAL
46  * }
47  */
48
49 struct ESS_signing_cert {
50     STACK_OF(ESS_CERT_ID) *cert_ids;
51     STACK_OF(POLICYINFO) *policy_info;
52 };
53
54 /*-
55  * ESSCertIDv2 ::=  SEQUENCE {
56  *        hashAlgorithm           AlgorithmIdentifier DEFAULT id-sha256,
57  *        certHash                Hash,
58  *        issuerSerial            IssuerSerial OPTIONAL
59  * }
60  */
61
62 struct ESS_cert_id_v2_st {
63     X509_ALGOR *hash_alg;       /* Default: SHA-256 */
64     ASN1_OCTET_STRING *hash;
65     ESS_ISSUER_SERIAL *issuer_serial;
66 };
67
68 /*-
69  * SigningCertificateV2 ::= SEQUENCE {
70  *        certs                   SEQUENCE OF ESSCertIDv2,
71  *        policies                SEQUENCE OF PolicyInformation OPTIONAL
72  * }
73  */
74
75 struct ESS_signing_cert_v2_st {
76     STACK_OF(ESS_CERT_ID_V2) *cert_ids;
77     STACK_OF(POLICYINFO) *policy_info;
78 };