CryptoSys PKI Toolkit Manual

PEM_FileToBinFile

PEM_FileToBinFile converts the contents of a PEM file into a binary file.

VB6/VBA Syntax

Public Declare Function PEM_FileToBinFile Lib "diCrPKI.dll" (ByVal strOutputFile As String, ByVal strFileIn As String) As Long

nRet = PEM_FileToBinFile(strOutputFile, strFileIn)

Parameters

strOutputFile
[in] String with name of output file to be created.
szFileIn
[in] String with the filename of the PEM-encoded file to be converted.

C/C++ Syntax

long _stdcall PEM_FileToBinFile(const char *szOutputFile, const char *szFileIn);

Returns (VB6/C)

Long: If successful, the return value is zero; otherwise it returns a non-zero error code.

.NET Equivalent

Pem.FileToBinFile Method

Remarks

Any base64-encoded data found between a PEM header and footer is converted into binary data and saved as a file.

-----BEGIN FOO BAR-----
MIAGCSqGSIb3DQEHA...
-----END FOO BAR-----

Example

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)"

See Also

PEM_FileFromBinFile

[Contents] [Index]

[HOME]   [NEXT: PFX_MakeFile...]

Copyright © 2004-9 D.I. Management Services Pty Ltd. All rights reserved.