Extracts an X.509 certificate from a PKCS-12 PFX/.p12 file, saving the output directly as a new file.
Public Declare Function X509_GetCertFromPFX Lib "diCrPKI.dll"
(ByVal strOutputFile As String, ByVal strPfxFile As String,
ByVal strPassword As String, ByVal nOptions As Long) As Long
nRet = X509_GetCertFromPFX(strOutputFile, strPfxFile,
strPassword, nOptions) As Long
String specifying the filename of the output file to be created.String containing the PFX filenameString containing password or "" if certificate is not encrypted
[new in v3.8]Long option flags: not used in this release. Specify zero.
long _stdcall X509_GetCertFromPFX(const char *szOutputFile, const char *szPFXFile, const char *szPassword,
long nOptions);
Long: If successful, it returns the number of bytes written to the output file;
otherwise it returns a negative error code.
X509.GetCertFromPFX Method (String, String)
X509.GetCertFromPFX Method (String, String, String)
The first encrypted X.509 certificate or pkcs-12-certBag found in the PFX file containing a
x509Certificate will be extracted and saved directly
as a DER-encoded X.509 certificate file.
Any existing file of the same name will be overwritten without warning.
[New in v3.8:] This will now extract certificates encrypted with the weak 40-bit encryption used by "default"
in Microsoft and OpenSSL PKCS-12 files.
If no certificate can be found it will now [as of v3.8] return a negative NO_DATA_ERROR error code.
nChars = X509_GetCertFromPFX("mycert.cer", "mypkcs12file.pfx", "password", 0)
will extract the first X.509 certificate, if any, found in the PKCS-12 file mypkcs12file.pfx
with password "password",
and save it as the new DER-encoded certificate file mycert.cer.
The variable nChars will contain the size in bytes of the new file it created.
X509_GetCertFromP7Chain PFX_MakeFile PFX_VerifySig