Can somebody help me convert an X509 certificate to the x509 structure format (like in Openssl) I have to get the tbscertificate field (present in x509 ASN1 DER notation) in MPLAB from a PEM formatted x509 certificate. I also want to know whether Microchip provides and test applications for x509 certificate validation
1
votes
1 Answers
0
votes
I hope the below code will give u an idea .. If your PEM doesnt have password ...... refer X509.h header file in openssl
X509* oCertificate=NULL;
FILE *lFp=NULL;
lFp=fopen(iFilePath,"rb");
if(lFp==NULL)
{
oCertificate=NULL;
cout <<("Error File cannot be opened(file missing) ")<<iFilePath ;
}
else
{
oCertificate = PEM_read_X509(lFp, NULL, NULL, NULL);
fclose(lFp);
}
return oCertificate;
openssl x509 -inform pem -outform der -in filename.pem -out filename.der
? – n. 1.8e9-where's-my-share m.