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.
eContent
) may be included or not (the latter case
is known as a "detached signature").To verify that the message content was indeed signed by the signer requires the recipient to do the following:
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 of the eContent. 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 or RSA-PSS signature algorithms and did not include message attributes,
then you cannot directly extract the message digest of the eContent.
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.