CryptoSys PKI examples VB6 to VB.NET

PEM_FileToBinFile

Converts the contents of a PEM file into a binary file.

VB6/VBA

Debug.Print "Testing PEM_FileToBinFile ..."
Dim nRet As Long
Dim strBinFile As String
Dim strPEMFile As String
Dim strDigest As String

' Input file is a PEM-encoded X.509 certificate
strPEMFile = "smallca.pem.cer"
strBinFile = "smallca-copy.cer"

' Convert to a binary file
nRet = PEM_FileToBinFile(strBinFile, strPEMFile)
Debug.Print "PEM_FiletoBinFile returns " & nRet & " (expecting 0)"

Output

Testing PEM_FileToBinFile ...
PEM_FiletoBinFile returns 0 (expecting 0)

VB.NET

Console.WriteLine("Testing PEM_FileToBinFile ...")
Dim nRet As Integer
Dim strBinFile As String
Dim strPEMFile As String

' Input file is a PEM-encoded X.509 certificate
strPEMFile = "smallca.pem.cer"
strBinFile = "smallca-copy.cer"

' Convert to a binary file
nRet = Pem.FileToBinFile(strBinFile, strPEMFile)
Console.WriteLine("PEM_FiletoBinFile returns " & nRet & " (expecting 0)")

[Contents]

[HOME]   [NEXT: PFX_MakeFile...]

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