(Unicode C) Convert Certificate from DER to PEM.
Loads a digital certificate from any format, such as DER, and saves to PEM format.
#include <C_CkCertW.h>
void ChilkatSample(void)
{
HCkCertW cert;
BOOL success;
cert = CkCertW_Create();
// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.
// In this case, load a DER format certificate and convert to PEM.
success = CkCertW_LoadFromFile(cert,L"qa_data/certs/testCert.cer");
if (success != TRUE) {
wprintf(L"%s\n",CkCertW_lastErrorText(cert));
CkCertW_Dispose(cert);
return;
}
success = CkCertW_ExportCertPemFile(cert,L"qa_data/certs/testCert.pem");
if (success != TRUE) {
wprintf(L"%s\n",CkCertW_lastErrorText(cert));
CkCertW_Dispose(cert);
return;
}
wprintf(L"Converted certificate from DER to PEM format.\n");
CkCertW_Dispose(cert);
}
|