CryptoSys PKI Toolkit Manual

CMS SignedData objects

A SignedData object is a digitally-signed container for arbitrary message content. You can create a SignedData object using one of the CMS_MakeSigData, CMS_MakeSigDataFromString, CMS_MakeSigDataFromSigValue, or CMS_MakeDetachedSig functions.

The original specification for a SignedData object is in RSA Lab's PKCS#7 Cryptographic Message Syntax Standard [PKCS7]. The last complete version of this document is version 1.5, which is also republished as RFC 2315. There is also a version 1.6 which is currently just an addendum note [PKCS7-EXT] and which extends the original specification. The CMS specification Cryptographic Message Syntax [CMS] is based on PKCS#7 version 1.5 and ties down some of its ambiguities. S/MIME [SMIME-MSG] uses the CMS specification. Between them, these various documents define five versions of a SignedData object. We support CMS version 1 only (but with a side order of PKCS#7 version 1.6 "naked" SignedData objects also thrown in) - see Supported Algorithms.

A CMS version 1 SignedData object has a variety of possible combinations in what it can contain:

By now we hope you have got the idea that there is whole host of combinations of how to deal with these objects. To verify that the message content was indeed signed by the signer requires the recipient to do the following:

  1. Obtain a copy of the signer's X.509 certificate, unless this is already included in the SignedData, and verify independently that this certificate is valid.
  2. Decrypt the signature in the SignedData using the public key inside the signer's certificate.
  3. Verify that the message digest of the eContent matches the message digest included in the SignedData.

The function CMS_VerifySigData carries out steps 2 and 3 directly with options for the user to pass the signer's certificate details if they are not already included and also to pass the message digest of the eContent for detached signatures.

The function CMS_GetSigDataDigest will extract the message digest, if possible, to enable the user to perform their own separate comparison with an independently-computed message digest. Note that being able to retrieve the message digest with this function implicitly verifies that the purported signer really did use their private key to sign the object. However, unlike the CMS_VerifySigData function, success with this function does not necessarily mean that the signer actually signed the eContent itself. Furthermore, if the signer used the DSA signature algorithm and did not include message attributes, then you cannot directly extract the message digest of the eContent. Confused so far? Try writing this manual.

To extract just the certificates themselves from a SignedData object, use the X509_GetCertFromP7Chain function. This will work for all types of SignedData objects, not just the "certs-only" type.

[Contents] [Index]

[HOME]   [NEXT: Using in MIME-conformant email messages...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.