class method
OpenSSL::Config.new
(?::_ToS filename) -> ::OpenSSL::Config
Config.new(filename) → OpenSSL::Config
ext/openssl/ossl_config.c
View on GitHub ↗
static VALUE
config_initialize(int argc, VALUE *argv, VALUE self)
{
CONF *conf = GetConfig(self);
VALUE filename;
/* 0-arguments call has no use-case, but is kept for compatibility */
rb_scan_args(argc, argv, "01", &filename);
rb_check_frozen(self);
if (!NIL_P(filename)) {
BIO *bio = BIO_new_file(StringValueCStr(filename), "rb");
if (!bio)
ossl_raise(eConfigError, "BIO_new_file");
config_load_bio(conf, bio); /* Consumes BIO */
}
rb_obj_freeze(self);
return self;
}
Creates an instance of OpenSSL::Config from the content of the file specified by filename.
This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
This can raise IO exceptions based on the access, or availability of the file. A ConfigError exception may be raised depending on the validity of the data being configured.