CryptoSys PKI Toolkit Manual

CMS_ReadSigData

Reads the content from a CMS signed-data object file.

VB6/VBA Syntax

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

Parameters

strFileOut
[in] String with name of output file to be created.
strFileIn
[in] String with name of signed-data CMS object file or the data as a base64 or PEM string.
nOptions
[in] Long option flags:
PKI_DEFAULT (0) for default options
PKI_CMS_FORMAT_BASE64 to read base64-encoded input (default expected BER-encoded binary) [not required in v3.5 and above]

C/C++ Syntax

long _stdcall CMS_ReadSigData(const char *szFileOut, const char *szFileIn, long nOptions);

Returns (VB6/C)

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.

.NET Equivalent

Cms.ReadSigDataToFile Method

Remarks

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.

Example

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.

See Also

CMS_ReadSigDataToString CMS_GetSigDataDigest

[Contents] [Index]

[HOME]   [NEXT: CMS_ReadSigDataToString...]

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