ess.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2019-2020 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. /* internal ESS related stuff */
  10. ESS_SIGNING_CERT *ESS_SIGNING_CERT_get(PKCS7_SIGNER_INFO *si);
  11. int ESS_SIGNING_CERT_add(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc);
  12. ESS_SIGNING_CERT *ESS_SIGNING_CERT_new_init(X509 *signcert,
  13. STACK_OF(X509) *certs,
  14. int issuer_needed);
  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. ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new_init(const EVP_MD *hash_alg,
  18. X509 *signcert,
  19. STACK_OF(X509) *certs,
  20. int issuer_needed);
  21. /* Returns < 0 if certificate is not found, certificate index otherwise. */
  22. int ess_find_cert_v2(const STACK_OF(ESS_CERT_ID_V2) *cert_ids, const X509 *cert);
  23. int ess_find_cert(const STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert);
  24. /*-
  25. * IssuerSerial ::= SEQUENCE {
  26. * issuer GeneralNames,
  27. * serialNumber CertificateSerialNumber
  28. * }
  29. */
  30. struct ESS_issuer_serial {
  31. STACK_OF(GENERAL_NAME) *issuer;
  32. ASN1_INTEGER *serial;
  33. };
  34. /*-
  35. * ESSCertID ::= SEQUENCE {
  36. * certHash Hash,
  37. * issuerSerial IssuerSerial OPTIONAL
  38. * }
  39. */
  40. struct ESS_cert_id {
  41. ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */
  42. ESS_ISSUER_SERIAL *issuer_serial;
  43. };
  44. /*-
  45. * SigningCertificate ::= SEQUENCE {
  46. * certs SEQUENCE OF ESSCertID,
  47. * policies SEQUENCE OF PolicyInformation OPTIONAL
  48. * }
  49. */
  50. struct ESS_signing_cert {
  51. STACK_OF(ESS_CERT_ID) *cert_ids;
  52. STACK_OF(POLICYINFO) *policy_info;
  53. };
  54. /*-
  55. * ESSCertIDv2 ::= SEQUENCE {
  56. * hashAlgorithm AlgorithmIdentifier DEFAULT id-sha256,
  57. * certHash Hash,
  58. * issuerSerial IssuerSerial OPTIONAL
  59. * }
  60. */
  61. struct ESS_cert_id_v2_st {
  62. X509_ALGOR *hash_alg; /* Default: SHA-256 */
  63. ASN1_OCTET_STRING *hash;
  64. ESS_ISSUER_SERIAL *issuer_serial;
  65. };
  66. /*-
  67. * SigningCertificateV2 ::= SEQUENCE {
  68. * certs SEQUENCE OF ESSCertIDv2,
  69. * policies SEQUENCE OF PolicyInformation OPTIONAL
  70. * }
  71. */
  72. struct ESS_signing_cert_v2_st {
  73. STACK_OF(ESS_CERT_ID_V2) *cert_ids;
  74. STACK_OF(POLICYINFO) *policy_info;
  75. };