Sample code for 30+ languages & platforms
VB.NET

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim cert As New Chilkat.Cert

success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password")
If (success <> True) Then
    Debug.WriteLine(cert.LastErrorText)
    Exit Sub
End If


Dim decrypt As New Chilkat.Crypt2
decrypt.CryptAlgorithm = "pki"

success = decrypt.SetDecryptCert(cert)
If (success <> True) Then
    Debug.WriteLine(decrypt.LastErrorText)
    Exit Sub
End If


Dim bd As New Chilkat.BinData
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat")

success = decrypt.DecryptBd(bd)
If (success <> True) Then
    Debug.WriteLine(decrypt.LastErrorText)
    Exit Sub
End If


' bd contains the decrypted content.