A CAdES Basic Electronic Signature (CAdES-BES) contains, among other specifications, a collection of Signing Certificate reference attributes, stored in the signedData ether as ESS signing-certificate or as ESS signing-certificate-v2. These are described in detail in Section 5.7.2 of RFC 5126 - CMS Advanced Electronic Signatures (CAdES). This patch adds support for adding ESS signing-certificate[-v2] attributes to CMS signedData. Although it implements only a small part of the RFC, it is sufficient many cases to enable the `openssl cms` app to create signatures which comply with legal requirements of some European States (e.g Italy). Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/7893)master
parent
9f5a87fd66
commit
e85d19c68e
@ -0,0 +1,3 @@
|
||||
LIBS=../../libcrypto
|
||||
SOURCE[../../libcrypto]= \
|
||||
ess_lib.c ess_asn1.c ess_err.c
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/ess.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/ess_int.h"
|
||||
|
||||
/* ASN1 stuff for ESS Structure */
|
||||
|
||||
ASN1_SEQUENCE(ESS_ISSUER_SERIAL) = {
|
||||
ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
|
||||
ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
|
||||
} static_ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const(ESS_ISSUER_SERIAL)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
|
||||
|
||||
ASN1_SEQUENCE(ESS_CERT_ID) = {
|
||||
ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
|
||||
ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
|
||||
} static_ASN1_SEQUENCE_END(ESS_CERT_ID)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const(ESS_CERT_ID)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
|
||||
|
||||
ASN1_SEQUENCE(ESS_SIGNING_CERT) = {
|
||||
ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
|
||||
ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
|
||||
} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
|
||||
|
||||
ASN1_SEQUENCE(ESS_CERT_ID_V2) = {
|
||||
ASN1_OPT(ESS_CERT_ID_V2, hash_alg, X509_ALGOR),
|
||||
ASN1_SIMPLE(ESS_CERT_ID_V2, hash, ASN1_OCTET_STRING),
|
||||
ASN1_OPT(ESS_CERT_ID_V2, issuer_serial, ESS_ISSUER_SERIAL)
|
||||
} static_ASN1_SEQUENCE_END(ESS_CERT_ID_V2)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const(ESS_CERT_ID_V2)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2)
|
||||
|
||||
ASN1_SEQUENCE(ESS_SIGNING_CERT_V2) = {
|
||||
ASN1_SEQUENCE_OF(ESS_SIGNING_CERT_V2, cert_ids, ESS_CERT_ID_V2),
|
||||
ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT_V2, policy_info, POLICYINFO)
|
||||
} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT_V2)
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2)
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/esserr.h>
|
||||
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
|
||||
static const ERR_STRING_DATA ESS_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_CERT_ID_NEW_INIT, 0),
|
||||
"ESS_CERT_ID_new_init"},
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_CERT_ID_V2_NEW_INIT, 0),
|
||||
"ESS_CERT_ID_V2_new_init"},
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_SIGNING_CERT_ADD, 0),
|
||||
"ESS_SIGNING_CERT_add"},
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_SIGNING_CERT_NEW_INIT, 0),
|
||||
"ESS_SIGNING_CERT_new_init"},
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_SIGNING_CERT_V2_ADD, 0),
|
||||
"ESS_SIGNING_CERT_V2_add"},
|
||||
{ERR_PACK(ERR_LIB_ESS, ESS_F_ESS_SIGNING_CERT_V2_NEW_INIT, 0),
|
||||
"ESS_SIGNING_CERT_V2_new_init"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
static const ERR_STRING_DATA ESS_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_ESS, 0, ESS_R_ESS_SIGNING_CERTIFICATE_ERROR),
|
||||
"ess signing certificate error"},
|
||||
{ERR_PACK(ERR_LIB_ESS, 0, ESS_R_ESS_SIGNING_CERT_ADD_ERROR),
|
||||
"ess signing cert add error"},
|
||||
{ERR_PACK(ERR_LIB_ESS, 0, ESS_R_ESS_SIGNING_CERT_V2_ADD_ERROR),
|
||||
"ess signing cert v2 add error"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
int ERR_load_ESS_strings(void)
|
||||
{
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
if (ERR_func_error_string(ESS_str_functs[0].error) == NULL) {
|
||||
ERR_load_strings_const(ESS_str_functs);
|
||||
ERR_load_strings_const(ESS_str_reasons);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ess.h>
|
||||
#include "internal/ess_int.h"
|
||||
|
||||
static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed);
|
||||
static ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new_init(const EVP_MD *hash_alg,
|
||||
X509 *cert, int issuer_needed);
|
||||
|
||||
ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,
|
||||
STACK_OF(X509) *certs,
|
||||
int issuer_needed)
|
||||
{
|
||||
ESS_CERT_ID *cid = NULL;
|
||||
ESS_SIGNING_CERT *sc;
|
||||
int i;
|
||||
|
||||
if ((sc = ESS_SIGNING_CERT_new()) == NULL)
|
||||
goto err;
|
||||
if (sc->cert_ids == NULL
|
||||
&& (sc->cert_ids = sk_ESS_CERT_ID_new_null()) == NULL)
|
||||
goto err;
|
||||
|
||||
if ((cid = ESS_CERT_ID_new_init(signcert, issuer_needed)) == NULL
|
||||
|| !sk_ESS_CERT_ID_push(sc->cert_ids, cid))
|
||||
goto err;
|
||||
for (i = 0; i < sk_X509_num(certs); ++i) {
|
||||
X509 *cert = sk_X509_value(certs, i);
|
||||
if ((cid = ESS_CERT_ID_new_init(cert, 1)) == NULL
|
||||
|| !sk_ESS_CERT_ID_push(sc->cert_ids, cid))
|
||||
goto err;
|
||||
}
|
||||
|
||||
return sc;
|
||||
err:
|
||||
ESS_SIGNING_CERT_free(sc);
|
||||
ESS_CERT_ID_free(cid);
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_NEW_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ESS_CERT_ID *ESS_CERT_ID_new_init(X509 *cert, int issuer_needed)
|
||||
{
|
||||
ESS_CERT_ID *cid = NULL;
|
||||
GENERAL_NAME *name = NULL;
|
||||
unsigned char cert_sha1[SHA_DIGEST_LENGTH];
|
||||
|
||||
/* Call for side-effect of computing hash and caching extensions */
|
||||
X509_check_purpose(cert, -1, 0);
|
||||
if ((cid = ESS_CERT_ID_new()) == NULL)
|
||||
goto err;
|
||||
X509_digest(cert, EVP_sha1(), cert_sha1, NULL);
|
||||
if (!ASN1_OCTET_STRING_set(cid->hash, cert_sha1, SHA_DIGEST_LENGTH))
|
||||
goto err;
|
||||
|
||||
/* Setting the issuer/serial if requested. */
|
||||
if (!issuer_needed)
|
||||
return cid;
|
||||
|
||||
if (cid->issuer_serial == NULL
|
||||
&& (cid->issuer_serial = ESS_ISSUER_SERIAL_new()) == NULL)
|
||||
goto err;
|
||||
if ((name = GENERAL_NAME_new()) == NULL)
|
||||
goto err;
|
||||
name->type = GEN_DIRNAME;
|
||||
if ((name->d.dirn = X509_NAME_dup(X509_get_issuer_name(cert))) == NULL)
|
||||
goto err;
|
||||
if (!sk_GENERAL_NAME_push(cid->issuer_serial->issuer, name))
|
||||
goto err;
|
||||
name = NULL; /* Ownership is lost. */
|
||||
ASN1_INTEGER_free(cid->issuer_serial->serial);
|
||||
if (!(cid->issuer_serial->serial =
|
||||
ASN1_INTEGER_dup(X509_get_serialNumber(cert))))
|
||||
goto err;
|
||||
|
||||
return cid;
|
||||
err:
|
||||
GENERAL_NAME_free(name);
|
||||
ESS_CERT_ID_free(cid);
|
||||
ESSerr(ESS_F_ESS_CERT_ID_NEW_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new_init(const EVP_MD *hash_alg,
|
||||
X509 *signcert,
|
||||
STACK_OF(X509) *certs,
|
||||
int issuer_needed)
|
||||
{
|
||||
ESS_CERT_ID_V2 *cid = NULL;
|
||||
ESS_SIGNING_CERT_V2 *sc;
|
||||
int i;
|
||||
|
||||
if ((sc = ESS_SIGNING_CERT_V2_new()) == NULL)
|
||||
goto err;
|
||||
if ((cid = ESS_CERT_ID_V2_new_init(hash_alg, signcert, issuer_needed)) == NULL)
|
||||
goto err;
|
||||
if (!sk_ESS_CERT_ID_V2_push(sc->cert_ids, cid))
|
||||
goto err;
|
||||
cid = NULL;
|
||||
|
||||
for (i = 0; i < sk_X509_num(certs); ++i) {
|
||||
X509 *cert = sk_X509_value(certs, i);
|
||||
|
||||
if ((cid = ESS_CERT_ID_V2_new_init(hash_alg, cert, 1)) == NULL)
|
||||
goto err;
|
||||
if (!sk_ESS_CERT_ID_V2_push(sc->cert_ids, cid))
|
||||
goto err;
|
||||
cid = NULL;
|
||||
}
|
||||
|
||||
return sc;
|
||||
err:
|
||||
ESS_SIGNING_CERT_V2_free(sc);
|
||||
ESS_CERT_ID_V2_free(cid);
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_V2_NEW_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new_init(const EVP_MD *hash_alg,
|
||||
X509 *cert, int issuer_needed)
|
||||
{
|
||||
ESS_CERT_ID_V2 *cid;
|
||||
GENERAL_NAME *name = NULL;
|
||||
unsigned char hash[EVP_MAX_MD_SIZE];
|
||||
unsigned int hash_len = sizeof(hash);
|
||||
X509_ALGOR *alg = NULL;
|
||||
|
||||
memset(hash, 0, sizeof(hash));
|
||||
|
||||
if ((cid = ESS_CERT_ID_V2_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
if (hash_alg != EVP_sha256()) {
|
||||
alg = X509_ALGOR_new();
|
||||
if (alg == NULL)
|
||||
goto err;
|
||||
X509_ALGOR_set_md(alg, hash_alg);
|
||||
if (alg->algorithm == NULL)
|
||||
goto err;
|
||||
cid->hash_alg = alg;
|
||||
alg = NULL;
|
||||
} else {
|
||||
cid->hash_alg = NULL;
|
||||
}
|
||||
|
||||
if (!X509_digest(cert, hash_alg, hash, &hash_len))
|
||||
goto err;
|
||||
|
||||
if (!ASN1_OCTET_STRING_set(cid->hash, hash, hash_len))
|
||||
goto err;
|
||||
|
||||
if (!issuer_needed)
|
||||
return cid;
|
||||
|
||||
if ((cid->issuer_serial = ESS_ISSUER_SERIAL_new()) == NULL)
|
||||
goto err;
|
||||
if ((name = GENERAL_NAME_new()) == NULL)
|
||||
goto err;
|
||||
name->type = GEN_DIRNAME;
|
||||
if ((name->d.dirn = X509_NAME_dup(X509_get_issuer_name(cert))) == NULL)
|
||||
goto err;
|
||||
if (!sk_GENERAL_NAME_push(cid->issuer_serial->issuer, name))
|
||||
goto err;
|
||||
name = NULL; /* Ownership is lost. */
|
||||
ASN1_INTEGER_free(cid->issuer_serial->serial);
|
||||
cid->issuer_serial->serial = ASN1_INTEGER_dup(X509_get_serialNumber(cert));
|
||||
if (cid->issuer_serial->serial == NULL)
|
||||
goto err;
|
||||
|
||||
return cid;
|
||||
err:
|
||||
X509_ALGOR_free(alg);
|
||||
GENERAL_NAME_free(name);
|
||||
ESS_CERT_ID_V2_free(cid);
|
||||
ESSerr(ESS_F_ESS_CERT_ID_V2_NEW_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si)
|
||||
{
|
||||
ASN1_TYPE *attr;
|
||||
const unsigned char *p;
|
||||
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificate);
|
||||
if (!attr)
|
||||
return NULL;
|
||||
p = attr->value.sequence->data;
|
||||
return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
|
||||
}
|
||||
|
||||
ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_get(PKCS7_SIGNER_INFO *si)
|
||||
{
|
||||
ASN1_TYPE *attr;
|
||||
const unsigned char *p;
|
||||
|
||||
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificateV2);
|
||||
if (attr == NULL)
|
||||
return NULL;
|
||||
p = attr->value.sequence->data;
|
||||
return d2i_ESS_SIGNING_CERT_V2(NULL, &p, attr->value.sequence->length);
|
||||
}
|
||||
|
||||
int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
|
||||
{
|
||||
ASN1_STRING *seq = NULL;
|
||||
unsigned char *p, *pp = NULL;
|
||||
int len;
|
||||
|
||||
len = i2d_ESS_SIGNING_CERT(sc, NULL);
|
||||
if ((pp = OPENSSL_malloc(len)) == NULL) {
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_ADD, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
p = pp;
|
||||
i2d_ESS_SIGNING_CERT(sc, &p);
|
||||
if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_ADD, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
OPENSSL_free(pp);
|
||||
pp = NULL;
|
||||
return PKCS7_add_signed_attribute(si,
|
||||
NID_id_smime_aa_signingCertificate,
|
||||
V_ASN1_SEQUENCE, seq);
|
||||
err:
|
||||
ASN1_STRING_free(seq);
|
||||
OPENSSL_free(pp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ESS_SIGNING_CERT_V2_add(PKCS7_SIGNER_INFO *si,
|
||||
ESS_SIGNING_CERT_V2 *sc)
|
||||
{
|
||||
ASN1_STRING *seq = NULL;
|
||||
unsigned char *p, *pp = NULL;
|
||||
int len = i2d_ESS_SIGNING_CERT_V2(sc, NULL);
|
||||
|
||||
if ((pp = OPENSSL_malloc(len)) == NULL) {
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_V2_ADD, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
p = pp;
|
||||
i2d_ESS_SIGNING_CERT_V2(sc, &p);
|
||||
if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
|
||||
ESSerr(ESS_F_ESS_SIGNING_CERT_V2_ADD, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
OPENSSL_free(pp);
|
||||
pp = NULL;
|
||||
return PKCS7_add_signed_attribute(si,
|
||||
NID_id_smime_aa_signingCertificateV2,
|
||||
V_ASN1_SEQUENCE, seq);
|
||||
err:
|
||||
ASN1_STRING_free(seq);
|
||||
OPENSSL_free(pp);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* internal ESS related stuff */
|
||||
|
||||
ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si);
|
||||
int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc);
|
||||
|
||||
ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_get(PKCS7_SIGNER_INFO *si);
|
||||
int ESS_SIGNING_CERT_V2_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT_V2 *sc);
|
||||
|
||||
/*-
|
||||
* IssuerSerial ::= SEQUENCE {
|
||||
* issuer GeneralNames,
|
||||
* serialNumber CertificateSerialNumber
|
||||
* }
|
||||
*/
|
||||
|
||||
struct ESS_issuer_serial {
|
||||
STACK_OF(GENERAL_NAME) *issuer;
|
||||
ASN1_INTEGER *serial;
|
||||
};
|
||||
|
||||
/*-
|
||||
* ESSCertID ::= SEQUENCE {
|
||||
* certHash Hash,
|
||||
* issuerSerial IssuerSerial OPTIONAL
|
||||
* }
|
||||
*/
|
||||
|
||||
struct ESS_cert_id {
|
||||
ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */
|
||||
ESS_ISSUER_SERIAL *issuer_serial;
|
||||
};
|
||||
|
||||
/*-
|
||||
* SigningCertificate ::= SEQUENCE {
|
||||
* certs SEQUENCE OF ESSCertID,
|
||||
* policies SEQUENCE OF PolicyInformation OPTIONAL
|
||||
* }
|
||||
*/
|
||||
|
||||
struct ESS_signing_cert {
|
||||
STACK_OF(ESS_CERT_ID) *cert_ids;
|
||||
STACK_OF(POLICYINFO) *policy_info;
|
||||
};
|
||||
|
||||
/*-
|
||||
* ESSCertIDv2 ::= SEQUENCE {
|
||||
* hashAlgorithm AlgorithmIdentifier DEFAULT id-sha256,
|
||||
* certHash Hash,
|
||||
* issuerSerial IssuerSerial OPTIONAL
|
||||
* }
|
||||
*/
|
||||
|
||||
struct ESS_cert_id_v2_st {
|
||||
X509_ALGOR *hash_alg; /* Default: SHA-256 */
|
||||
ASN1_OCTET_STRING *hash;
|
||||
ESS_ISSUER_SERIAL *issuer_serial;
|
||||
};
|
||||
|
||||
/*-
|
||||
* SigningCertificateV2 ::= SEQUENCE {
|
||||
* certs SEQUENCE OF ESSCertIDv2,
|
||||
* policies SEQUENCE OF PolicyInformation OPTIONAL
|
||||
* }
|
||||
*/
|
||||
|
||||
struct ESS_signing_cert_v2_st {
|
||||
STACK_OF(ESS_CERT_ID_V2) *cert_ids;
|
||||
STACK_OF(POLICYINFO) *policy_info;
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CMS_add1_signing_cert, CMS_add1_signing_cert_v2
|
||||
- add ESS signing-certificate signed attribute to a
|
||||
CMS_SignerInfo data structure
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/cms.h>
|
||||
|
||||
int CMS_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc);
|
||||
|
||||
int CMS_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc2);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
CMS_add1_signing_cert() adds an ESS Signing Certificate B<sc> (version 1) signed
|
||||
attribute to the CMS_SignerInfo B<si>.
|
||||
CMS_add1_signing_cert_v2() adds an ESS Signing Certificate B<sc2> (version 2) signed
|
||||
attribute to the CMS_SignerInfo B<si>.
|
||||
The ESS Signing Certificate attributes version 1 and 2 are defined in RFC 5035
|
||||
which updates Section 5.4 of RFC 2634.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
This attribute is mandatory to make a CMS compliant with CAdES-BES
|
||||
(European Standard ETSI EN 319 122-1 V1.1.1).
|
||||
For a fuller description see L<cms(1)>).
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
CMS_add1_signing_cert() and CMS_add1_signing_cert_v2() return 1 if attribute is added or 0 if an error occurred.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|