pkcs7.asn1 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. -- SPDX-License-Identifier: BSD-3-Clause
  2. --
  3. -- Copyright (C) 2009 IETF Trust and the persons identified as authors
  4. -- of the code
  5. --
  6. -- https://www.rfc-editor.org/rfc/rfc5652#section-3
  7. PKCS7ContentInfo ::= SEQUENCE {
  8. contentType ContentType ({ pkcs7_check_content_type }),
  9. content [0] EXPLICIT SignedData OPTIONAL
  10. }
  11. ContentType ::= OBJECT IDENTIFIER ({ pkcs7_note_OID })
  12. SignedData ::= SEQUENCE {
  13. version INTEGER ({ pkcs7_note_signeddata_version }),
  14. digestAlgorithms DigestAlgorithmIdentifiers,
  15. contentInfo ContentInfo ({ pkcs7_note_content }),
  16. certificates CHOICE {
  17. certSet [0] IMPLICIT ExtendedCertificatesAndCertificates,
  18. certSequence [2] IMPLICIT Certificates
  19. } OPTIONAL ({ pkcs7_note_certificate_list }),
  20. crls CHOICE {
  21. crlSet [1] IMPLICIT CertificateRevocationLists,
  22. crlSequence [3] IMPLICIT CRLSequence
  23. } OPTIONAL,
  24. signerInfos SignerInfos
  25. }
  26. ContentInfo ::= SEQUENCE {
  27. contentType ContentType ({ pkcs7_note_OID }),
  28. content [0] EXPLICIT Data OPTIONAL
  29. }
  30. Data ::= ANY ({ pkcs7_note_data })
  31. DigestAlgorithmIdentifiers ::= CHOICE {
  32. daSet SET OF DigestAlgorithmIdentifier,
  33. daSequence SEQUENCE OF DigestAlgorithmIdentifier
  34. }
  35. DigestAlgorithmIdentifier ::= SEQUENCE {
  36. algorithm OBJECT IDENTIFIER ({ pkcs7_note_OID }),
  37. parameters ANY OPTIONAL
  38. }
  39. --
  40. -- Certificates and certificate lists
  41. --
  42. ExtendedCertificatesAndCertificates ::= SET OF ExtendedCertificateOrCertificate
  43. ExtendedCertificateOrCertificate ::= CHOICE {
  44. certificate Certificate, -- X.509
  45. extendedCertificate [0] IMPLICIT ExtendedCertificate -- PKCS#6
  46. }
  47. ExtendedCertificate ::= Certificate -- cheating
  48. Certificates ::= SEQUENCE OF Certificate
  49. CertificateRevocationLists ::= SET OF CertificateList
  50. CertificateList ::= SEQUENCE OF Certificate -- This may be defined incorrectly
  51. CRLSequence ::= SEQUENCE OF CertificateList
  52. Certificate ::= ANY ({ pkcs7_extract_cert }) -- X.509
  53. --
  54. -- Signer information
  55. --
  56. SignerInfos ::= CHOICE {
  57. siSet SET OF SignerInfo,
  58. siSequence SEQUENCE OF SignerInfo
  59. }
  60. SignerInfo ::= SEQUENCE {
  61. version INTEGER ({ pkcs7_note_signerinfo_version }),
  62. sid SignerIdentifier, -- CMS variant, not PKCS#7
  63. digestAlgorithm DigestAlgorithmIdentifier ({ pkcs7_sig_note_digest_algo }),
  64. authenticatedAttributes CHOICE {
  65. aaSet [0] IMPLICIT SetOfAuthenticatedAttribute
  66. ({ pkcs7_sig_note_set_of_authattrs }),
  67. aaSequence [2] EXPLICIT SEQUENCE OF AuthenticatedAttribute
  68. -- Explicit because easier to compute digest on
  69. -- sequence of attributes and then reuse encoded
  70. -- sequence in aaSequence.
  71. } OPTIONAL,
  72. digestEncryptionAlgorithm
  73. DigestEncryptionAlgorithmIdentifier ({ pkcs7_sig_note_pkey_algo }),
  74. encryptedDigest EncryptedDigest,
  75. unauthenticatedAttributes CHOICE {
  76. uaSet [1] IMPLICIT SET OF UnauthenticatedAttribute,
  77. uaSequence [3] IMPLICIT SEQUENCE OF UnauthenticatedAttribute
  78. } OPTIONAL
  79. } ({ pkcs7_note_signed_info })
  80. SignerIdentifier ::= CHOICE {
  81. -- RFC5652 sec 5.3
  82. issuerAndSerialNumber IssuerAndSerialNumber,
  83. subjectKeyIdentifier [0] IMPLICIT SubjectKeyIdentifier
  84. }
  85. IssuerAndSerialNumber ::= SEQUENCE {
  86. issuer Name ({ pkcs7_sig_note_issuer }),
  87. serialNumber CertificateSerialNumber ({ pkcs7_sig_note_serial })
  88. }
  89. CertificateSerialNumber ::= INTEGER
  90. SubjectKeyIdentifier ::= OCTET STRING ({ pkcs7_sig_note_skid })
  91. SetOfAuthenticatedAttribute ::= SET OF AuthenticatedAttribute
  92. AuthenticatedAttribute ::= SEQUENCE {
  93. type OBJECT IDENTIFIER ({ pkcs7_note_OID }),
  94. values SET OF ANY ({ pkcs7_sig_note_authenticated_attr })
  95. }
  96. UnauthenticatedAttribute ::= SEQUENCE {
  97. type OBJECT IDENTIFIER,
  98. values SET OF ANY
  99. }
  100. DigestEncryptionAlgorithmIdentifier ::= SEQUENCE {
  101. algorithm OBJECT IDENTIFIER ({ pkcs7_note_OID }),
  102. parameters ANY OPTIONAL
  103. }
  104. EncryptedDigest ::= OCTET STRING ({ pkcs7_sig_note_signature })
  105. ---
  106. --- X.500 Name
  107. ---
  108. Name ::= SEQUENCE OF RelativeDistinguishedName
  109. RelativeDistinguishedName ::= SET OF AttributeValueAssertion
  110. AttributeValueAssertion ::= SEQUENCE {
  111. attributeType OBJECT IDENTIFIER ({ pkcs7_note_OID }),
  112. attributeValue ANY
  113. }