CryptoSys PKI Toolkit Manual

X509_SaveFileFromString

Creates an X.509 certificate file from its base64 string representation.

VB6/VBA Syntax

Public Declare Function X509_SaveFileFromString Lib "diCrPKI.dll" (ByVal strNewCertFile As String, ByVal strCertString As String, ByVal nOptions As Long) As Long

nRet = X509_SaveFileFromString(strNewCertFile, strCertString, nOptions)

Parameters

strNewCertFile
[in] String with name of X.509 certificate file to be created.
strCertString
[in] String containing the base64 representation of the certificate.
nOptions
[in] Long option flags:
PKI_X509_FORMAT_PEM to save the certificate in PEM format (default = DER-encoded binary)

C/C++ Syntax

long _stdcall X509_SaveFileFromString(const char *szNewCertFile, const char *szCertString, long nOptions);

Returns (VB6/C)

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

.NET Equivalent

X509.SaveFileFromString Method

Remarks

This function creates a new X.509 certificate file from a base64 string. It is the reverse of X509_ReadStringFromFile. Any existing file of the same name will be overwritten without warning. The default option (nOptions = 0) is to save the file in binary (BER, DER) format. A PEM format file will start with -----BEGIN CERTIFICATE----- and will contain the same base64 characters as in the certificate string. Both formats should be equally readable with the usual certificate manager programs and both should have the same message digest "thumbprint".

Example

See the example in X509_ReadStringFromFile.

See Also

X509_ReadStringFromFile

[Contents] [Index]

[HOME]   [NEXT: X509_TextDump...]

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