CryptoSys PKI Pro Manual

PEM_FileToBinFile

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

VBA/VB6 Syntax

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

nRet = PEM_FileToBinFile(strOutputFile, strFileIn)

C/C++ Syntax

long __stdcall PEM_FileToBinFile(const char *szFileOut, const char *szFileIn);

Parameters

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

Returns (VBA/C)

If successful, the return value is zero; otherwise it returns a nonzero error code.

.NET Equivalent

Pem.FileToBinFile Method

C++ (STL) Equivalent

static int dipki::Pem::FileToBinFile (const std::string &fileToMake, const std::string &fileIn)

Python Equivalent

static Pem.to_binfile(outputfile, filein)

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]

[PREV: PEM_FileFromBinFileEx...]   [Contents]   [Index]   
   [NEXT: PFX_MakeFile...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.