CryptoSys PKI examples VB6 to VB.NET

CMS_MakeEnvData

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]

[HOME]   [NEXT: CMS_MakeEnvData2...]

Copyright © 2010-20 D.I. Management Services Pty Ltd. All rights reserved.