CryptoSys PKI Pro Manual

Example: Cms.ReadEnvData  Cms.ReadEnvDataToFile  Rsa.ReadPrivateKey  Wipe.String 

[VB6 equivalent: CMS_ReadEnvData]

Dim nRet As Integer
Dim strFileIn As String
Dim strFileOut As String
Dim sbPrivateKey As StringBuilder

' Bob reads his private key into a string
sbPrivateKey = Rsa.ReadPrivateKey("BobPrivRSAEncrypt.p8e", "password")
If sbPrivateKey.Length = 0 Then
    Console.WriteLine("Cannot read private key")
    Exit Sub
End If

' Decrypt the input file, send plaintext to new output file
strFileIn = "cmsalice2bob.p7m"
strFileOut = "fromalice.txt"
nRet = Cms.ReadEnvDataToFile(strFileOut, strFileIn, "", sbPrivateKey.ToString())
Console.WriteLine("CMS_ReadEnvData returns " & nRet)

' Clean up
Wipe.String(sbPrivateKey)

See Also:
Cms.ReadEnvDataToFile Method

[Contents] [Index]

[PREV: Example: Cms.MakeSigDataFromSigValue ...]   [Contents]   [Index]   
   [NEXT: Example: Cms.QueryEnvData ...]

Copyright © 2004-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-09-18T10:02:53Z.