int ret = R_ERROR_NONE;
BIO *bio_out;
R_LIB_CTX *lib_ctx;
R_CERT_CTX *cert_ctx = NULL;
R_CERT *cert = NULL;
char *certfile;
...
if ((ret = R_CERT_CTX_new(lib_ctx, R_RES_FLAG_DEF, R_CERT_TYPE_X509,
&cert_ctx)) != R_ERROR_NONE)
{
BIO_printf(bio_out, "Certificate context new failure\n");
goto end:
}
if ((ret = R_CERT_read_file(cert_ctx, certfile, R_CERT_TYPE_X509,
R_FORMAT_BINARY, &cert)) != R_ERROR_NONE)
{
BIO_printf(bio_out, "Certificate read failure\n");
goto end;
}
if (R_CERT_test_key_usage(cert, R_CERT_KEY_USAGE_KEY_CERT_SIGN) == 1)
{
BIO_printf(bio_out, "The certificate sign key usage extension is set\n");
}
else
{
BIO_printf(bio_out, "The certificate sign key usage extension is not set\n");
}
...
end:
if (ret != R_ERROR_NONE)
{
}