Create an encrypted CMS enveloped-data object for one or more recipients using their X.509 certificates.
VB6/VBA
Debug.Print "Testing CMS_MakeEnvData ..." Dim nRet As Long Dim strOutputFile As String Dim strInputFile As String Dim strCertFile As String strOutputFile = "cmsalice2bob.p7m" strInputFile = "excontent.txt" strCertFile = "BobRSASignByCarl.cer" ' This should return 1 (indicating one successful recipient) nRet = CMS_MakeEnvData(strOutputFile, strInputFile, strCertFile, "", 0, 0) Debug.Print "CMS_MakeEnvData returns " & nRet
Output
Testing CMS_MakeEnvData ... CMS_MakeEnvData returns 1
VB.NET
Console.WriteLine("Testing CMS_MakeEnvData ...")
Dim nRet As Integer
Dim strOutputFile As String
Dim strInputFile As String
Dim strCertFile As String
strOutputFile = "cmsalice2bob.p7m"
strInputFile = "excontent.txt"
strCertFile = "BobRSASignByCarl.cer"
' This should return 1 (indicating one successful recipient)
nRet = Cms.MakeEnvData(strOutputFile, strInputFile, strCertFile, 0)
Console.WriteLine("CMS_MakeEnvData returns " & nRet)
[Contents]