PKCS-7 签名

文章详细描述了数字签名的数据结构SignedData,包括版本、摘要算法、内容信息、证书和CRLs的选择以及签名人信息等组件。同时提到了AlgorithmIdentifier、ContentInfo、Certificate序列和DigestAlgorithmIdentifiers等关键概念在签名过程中的作用。
摘要由CSDN通过智能技术生成

SignedData ::= SEQUENCE {
  version         INTEGER {sdVer1(1), sdVer2(2)} (sdVer1 | sdVer2),
  digestAlgorithms                  DigestAlgorithmIdentifiers,
  contentInfo                           ContentInfo,
  certificates CHOICE {
        certSet                [0] IMPLICIT ExtendedCertificatesAndCertificates,
        certSequence     [2] IMPLICIT Certificates
       } OPTIONAL,
   crls CHOICE {
        crlSet               [1] IMPLICIT CertificateRevocationLists,
        crlSequence    [3] IMPLICIT CRLSequence
      } OPTIONAL,
   signerInfos     SignerInfos

Version ::= INTEGER

DigestAlgorithmIdentifiers ::= CHOICE {
  daSet                 SET OF DigestAlgorithmIdentifier,
  daSequence      SEQUENCE OF DigestAlgorithmIdentifier
}

DigestAlgorithmIdentifier ::=  AlgorithmIdentifier

ContentInfo ::= SEQUENCE {
  contentType  ContentType,
  content          [0] EXPLICIT CONTENTS.&Type({Contents}{@contentType}) 
OPTIONAL
}

CONTENTS ::= TYPE-IDENTIFIER

Contents CONTENTS ::= {
  {Data                    IDENTIFIED BY data}                   |
  {SignedData              IDENTIFIED BY signedData}             |
  {EnvelopedData           IDENTIFIED BY envelopedData}          |
  {SignedAndEnvelopedData  IDENTIFIED BY signedAndEnvelopedData} |
  {DigestedData            IDENTIFIED BY digestedData}           |
  {EncryptedData           IDENTIFIED BY encryptedData},
  ...  -- add any application-specific types/contents here
}

ContentType ::= CONTENTS.&id({Contents})

Data ::= OCTET STRING

ExtendedCertificatesAndCertificates ::=  SET OF ExtendedCertificateOrCertificateExtendedCertificateOrCertificate ::= CHOICE {
  certificate          Certificate,                      -- X.509
  extendedCertificate  [0] IMPLICIT ExtendedCertificate  -- PKCS#6
}

ExtendedCertificate ::= Certificate -- cheating

CertificateRevocationLists ::=  SET OF CertificateList

CRLSequence ::=  SEQUENCE OF CertificateList

Certificates ::=  SEQUENCE OF Certificate

AlgorithmIdentifier {ALGORITHM:IOSet} ::= SEQUENCE {
   algorithm   ALGORITHM.&id({IOSet}),
   parameters  ALGORITHM.&Type({IOSet}{@algorithm}) OPTIONAL
}

Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
  type    ATTRIBUTE.&id({IOSet}),
  values  SET SIZE (1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})
}

SignerInfos ::= CHOICE {
    siSet         SET OF SignerInfo,
    siSequence    SEQUENCE OF SignerInfo
}

SignerInfo ::= SEQUENCE {
  version         INTEGER {siVer1(1), siVer2(2)} (siVer1 | siVer2),
  issuerAndSerialNumber                  IssuerAndSerialNumber,
  digestAlgorithm DigestAlgorithmIdentifier,
  authenticatedAttributes CHOICE {
        aaSet         [0] IMPLICIT SET OF Attribute {{Authenticated}},
        aaSequence    [2] EXPLICIT SEQUENCE OF Attribute {{Authenticated}}
        -- Explicit because easier to compute digest on sequence of attributes and then reuse
        -- encoded sequence in aaSequence.
      } OPTIONAL,
  digestEncryptionAlgorithm                  DigestEncryptionAlgorithmIdentifier,
  encryptedDigest     EncryptedDigest,
  unauthenticatedAttributes CHOICE {
    uaSet         [1] IMPLICIT SET OF Attribute {{Unauthenticated}},
    uaSequence    [3] IMPLICIT SEQUENCE OF Attribute {{Unauthenticated}}
  } OPTIONAL
}

IssuerAndSerialNumber ::= SEQUENCE {
  issuer        Name,
  serialNumber  CertificateSerialNumber
}

DigestEncryptionAlgorithmIdentifier ::=  AlgorithmIdentifier

EncryptedDigest ::= OCTET STRING
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值