1
votes

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
I have no solution for you, but usually the certificate agency supplies the certificates in both formats. Why do you lack the apache formatted certificate file?0xCAFEBABE
Have you tried openssl x509 -inform pem -outform der -in filename.pem -out filename.der?n. 1.8e9-where's-my-share m.
Actually I want to create an x509 structure in MPLAB from the certificate I'm recieving and since PIC has no file system, I have to use Byte arrays. The problem is with reading these PEM formatted certificate into the x509 structure fieldsTijo Thomas John

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;