Topic: ParseCert returns -144. on RIOT Os
I am trying to parse a csr using wolfssl in RIOT operating system.https://doc.riot-os.org/group__pkg__wolfssl.html
file = fopen(file_name, "rb");
if (!file) {
printf("can't open certificate\n");
return 1;
}
pem_cert_size = fread(pem_cert_buf, 1,LARGE_TEMP_SZ, file);
fclose(file);
printf("Successfully read %d bytes from %s\n\n", pem_cert_size, file_name);
if (pem_cert_size <= 0) {
printf("pem cert read error:%d\n", (int)pem_cert_size);
return 1;
}
DEBUG("\n\npem cert size:%d\n\n", pem_cert_size);
der_cert_size = wc_CertPemToDer(pem_cert_buf, pem_cert_size, der_cert_buf, LARGE_TEMP_SZ,
CERTREQ_TYPE);
if (der_cert_size <= 0) {
printf("cant convert pem to der:%d\n", (int)der_cert_size);
return 1;
}
printf("Converted CSR Cert PEM to DER %d bytes\n", der_cert_size);
#ifdef HAVE_DECODEDCERT
InitDecodedCert(&decoded_cert, der_cert_buf,der_cert_size, NULL);
int ret = ParseCert(&decoded_cert, CERTREQ_TYPE, NO_VERIFY, NULL);
printf("ParseCert ret:%d\n",ret);
#endif
I am following the https://github.com/wolfSSL/wolfssl-exam … csr_sign.c sample.I have enabled WOLFSSL_TEST_CERT. I was able to parse a x509 certificate and get the contents in "DecodedCert".Now I want to do the same with Certfificate signing requests.But ParseCert function throws error. Could anyone help with the problem ? WolfSSL debugging is given below
Successfully read 428 bytes from testcsr1.pem
wolfSSL Entering wc_CertPemToDer
wolfSSL Entering PemToDer
Converted CSR Cert PEM to DER 264 bytes
wolfSSL Entering GetExplicitVersion
wolfSSL Entering GetSerialNumber
Got Cert Header
wolfSSL Entering GetAlgoId
wolfSSL Entering GetObjectId()
ParseCert ret:-144