CryptoSys PKI Pro Manual

CMS_ReadSigData

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

VBA/VB6 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

C/C++ Syntax

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

Parameters

szFileOut
[in] with name of output file to be created.
szFileIn
[in] with name of signed-data CMS object file (binary or base64-encoded) or the data as a base64 or PEM string.
nOptions
[in] option flags:
PKI_DEFAULT (0) for default options
PKI_CMS_BIGFILE to speed up the processing of large files (binary input only).

Returns (VBA/C)

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

C++ (STL) Equivalent

static int dipki::Cms::ReadSigDataToFile (const std::string &outputFile, const std::string &inputFile, bool bigFile=false)

Python Equivalent

static Cms.read_sigdata_to_file(outputfile, inputfile, bigfile=False)

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.

This function automatically checks for and reads "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 in the example for 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 = "BasicSignByAlice.bin"
strFileOut = "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]

[PREV: CMS_ReadEnvDataToString...]   [Contents]   [Index]   
   [NEXT: CMS_ReadSigDataToBytes...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.