Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
OpenSSL::Config#to_s
config.to_s → string
ext/openssl/ossl_config.c
View on GitHub ↗
static VALUE
config_to_s(VALUE self)
{
CONF *conf = GetConfig(self);
VALUE str;
str = rb_str_new(NULL, 0);
lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(dump_conf_value),
&str);
return str;
}
Gets the parsable form of the current configuration.
Given the following configuration being created:
Example
config = OpenSSL::Config.new #=> #<OpenSSL::Config sections=[]> config['default'] = {"foo"=>"bar","baz"=>"buz"} #=> {"foo"=>"bar", "baz"=>"buz"} puts config.to_s #=> [ default ] # foo=bar # baz=buz
You can parse get the serialized configuration using to_s and then parse it later:
Example
serialized_config = config.to_s # much later... new_config = OpenSSL::Config.parse(serialized_config) #=> #<OpenSSL::Config sections=["default"]> puts new_config #=> [ default ] foo=bar baz=buz