diff --git a/ACE/ace/SSL/SSL_Context.cpp b/ACE/ace/SSL/SSL_Context.cpp index ebc883ed93ab2..0a42301fbf9e9 100644 --- a/ACE/ace/SSL/SSL_Context.cpp +++ b/ACE/ace/SSL/SSL_Context.cpp @@ -550,6 +550,54 @@ ACE_SSL_Context::load_trusted_ca (const char* ca_file, return 0; } +int +ACE_SSL_Context::load_crl_file(const char *file_name, int type) +{ + if (context_ == nullptr || file_name == nullptr) + { + return 0; + } + + int ret = 0; + BIO *in = nullptr; + X509_CRL *x = nullptr; + X509_STORE *st = ::SSL_CTX_get_cert_store(context_); + if (st == nullptr) + { + goto err; + } + + if (type == SSL_FILETYPE_PEM) + { + ret = ::SSL_CTX_load_verify_locations(context_, file_name, nullptr); + } + else if (type == SSL_FILETYPE_ASN1) + { + in = BIO_new(BIO_s_file()); + if (in == nullptr || BIO_read_filename(in, file_name) <= 0) + { + goto err; + } + x = d2i_X509_CRL_bio(in, nullptr); + if (x == nullptr) + { + goto err; + } + ret = ::X509_STORE_add_crl(st, x); + } + + if (ret == 1) + { + (void)X509_STORE_set_flags(st, X509_V_FLAG_CRL_CHECK); + } + +err: + X509_CRL_free(x); + (void)BIO_free(in); + + return ret; +} + int ACE_SSL_Context::private_key (const char *file_name, int type) diff --git a/ACE/ace/SSL/SSL_Context.h b/ACE/ace/SSL/SSL_Context.h index 97eae945e62d9..3a57dac17d971 100644 --- a/ACE/ace/SSL/SSL_Context.h +++ b/ACE/ace/SSL/SSL_Context.h @@ -254,6 +254,19 @@ class ACE_SSL_Export ACE_SSL_Context const char* ca_dir = 0, bool use_env_defaults = true); + /** + * Load the location of the CRL. + * + * @param[in] file_name CRL file pathname. Passed to + * @c SSL_CTX_Load_verify_locations() if not + * 0 and @a type is SSL_FILETYPE_PEM. Pass to + * @c X509_STORE_add_crl if not 0 @a type is SSL_FILETYPE_ASN1. + * @param[in] type CRL file type. Support SSL_FILETYPE_PEM and + * SSL_FILETYPE_ASN1. + * @return 1 for success or others on error. + */ + int load_crl_file(const char* file_name, int type); + /** * Test whether any CA locations have been successfully loaded and * return the number of successful attempts. diff --git a/TAO/docs/Security/SSLIOP-USAGE.html b/TAO/docs/Security/SSLIOP-USAGE.html index 24297ac067c84..2bd7bc37f41f6 100644 --- a/TAO/docs/Security/SSLIOP-USAGE.html +++ b/TAO/docs/Security/SSLIOP-USAGE.html @@ -167,6 +167,10 @@
-SSLCAfile
filename-SSLCRLFile
filename-SSLCApath
directory