Skip to content
instance method

OpenSSL::Config#to_s

() -> ::String
config.to_s → string

Gets the parsable form of the current configuration.

Given the following configuration file being loaded:

Example
config = OpenSSL::Config.load('baz.cnf')
  #=> #<OpenSSL::Config sections=["default"]>
puts config.to_s
  #=> [ default ]
  #   foo=bar
  #   baz=buz

You can 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
See also #sections #inspect also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0