|
|
Creates a new certificate context. -
Parameters:
-
| lib_ctx |
[In] The library context. |
| flag |
[In] The flag indicating scope.
See Flags for valid values. |
| certtype |
[In] The certificate type.
See Certificate Types for valid values. |
| cert_ctx |
[Out] The created certificate context. |
-
Returns:
-
R_ERROR_NONE indicates success.
See Identifiers for valid values.
-
See also:
-
R_CERT_CTX_free().
-
Example:
-
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)
{
}
-
Samples:
-
cert.c, cert_smpl.c, cm_env.c, cm_env_sm.c, cm_env_strm.c, cm_env_strm_membio.c, cm_open.c, cm_open_strm.c, cm_open_strm_cb.c, cm_open_strm_membio.c, cm_sign.c, cm_sign_dgst.c, cm_sign_sm.c, cm_sign_strm.c, ext.c, frombuf.c, ocsp_req_create.c, p7ssl_client.c, rcert2sslcert.c, req.c, reqgen.c, ss_cert_smpl.c, sslcert2rcert.c, store.c, verify.c, vfy_adv.c, vfy_bc.c, and vfy_smpl.c.
|