CryptoSys PKI Toolkit Manual

CMS_MakeEnvDataFromString

CMS_MakeEnvDataFromString is the same as CMS_MakeEnvData except the input data is in an ANSI string instead of a file.

VB6/VBA Syntax

Public Declare Function CMS_MakeEnvDataFromString Lib "diCrPKI.dll" (ByVal strFileOut As String, ByVal strDataIn As String, ByVal strCertList As String, ByVal strSeed As String, ByVal nSeedLen As Long, ByVal nOptions As Long) As Long

nRet = CMS_MakeEnvDataFromString(strFileOut, strDataIn, strCertList, strSeed, nSeedLen, nOptions) As Long

Parameters

strFileOut
[in] String with name of output file to be created.
strDataIn
[in] String containing input data.
strCertList
[in] String containing a list of files that contain the certificates of recipients separated by semi-colons(;)
strSeed
[in] String containing a user-specified seed to be used by the random number generator. Specify an empty string ("") to ignore.
nSeedLen
[in] Long specifying the length of the seed string.
nOptions
[in] Long option flags:
PKI_DEFAULT (0) for default options
PKI_CMS_FORMAT_BASE64 to format the output with base64 encoding (default output is binary)

C/C++ Syntax

long _stdcall CMS_MakeEnvDataFromString(const char *szFileOut, const char *szDataIn, const char *szCertList, const char *sSeed, long nSeedLen, long nOptions);

Returns (VB6/C)

Long: If successful, the return value is the number of successful recipients; otherwise it returns a negative error code.

.NET Equivalent

Cms.MakeEnvData Method
Cms.MakeEnvData Method

Remarks

See the remarks for CMS_MakeEnvData above. The input string must only contain ANSI characters. To encrypt binary data or Unicode characters, save as a binary data file and use CMS_MakeEnvData.

Example

The following example reproduces example 5.2 from SMIME-EX (as far as it can, because of the different random values used each time) passing the input data as a string. The output is always a new file.

' This should return 1 (indicating one successful recipient)
nRet = CMS_MakeEnvDataFromString("C:\test\cmsalice2bob1.p7m", _
    "This is some sample content.", "C:\test\BobRSASignByCarl.cer", "", 0, 0)
Debug.Print "CMS_MakeEnvDataFromString returns " & nRet

See Also

CMS_MakeEnvData CMS_ReadEnvData CMS_ReadEnvDataToString

[Contents] [Index]

[HOME]   [NEXT: CMS_MakeSigData...]

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