Reads the content from a CMS signed-data object file.
Public Declare Function CMS_ReadSigData Lib "diCrPKI.dll"
(ByVal strFileOut As String, ByVal strFileIn As String,
ByVal nOptions As Long) As Long
nRet = CMS_ReadSigData(strFileOut, strFileIn,
nOptions) As Long
String with name of output file to be created.String with name of signed-data CMS object file
or the data as a base64 or PEM string.Long option flags: PKI_CMS_FORMAT_BASE64 to read base64-encoded input (default expected BER-encoded binary)
[not required in v3.5 and above]
long _stdcall CMS_ReadSigData(const char *szFileOut, const char *szFileIn,
long nOptions);
Long: If successful, the return value is a positive number indicating the number of bytes in the content;
otherwise it returns a negative error code.
This function extracts the signed data from the signed-data CMS object without making any attempt to verify it. Any existing file with the same name as the specified output will be overwritten without further warning.
New in Version 2.8: This function will now automatically check for and read "naked" SignedData files as per PKCS#7 version 1.6 [PKCS7-EXT] as well as the default SignedData objects properly encapsulated in an outerContentInfo as per the S/MIME standard.
This example reads the content from the signed CMS object created by CMS_MakeSigData above. The output is written directly to a file and should contain the 28 bytes "This is some sample content."
Dim nRet As Long
Dim strFileIn As String
Dim strFileOut As String
strFileIn = "C:\Test\BasicSignByAlice.bin"
strFileOut = "C:\Test\BasicSignByAlice.dat"
nRet = CMS_ReadSigData(strFileOut, strFileIn, 0)
Debug.Print "CMS_ReadSigData returns " & nRet
The function should return 28 indicating the number of bytes written to the output file.
CMS_ReadSigDataToString CMS_GetSigDataDigest