Configuration for the openssl library.

Many system’s installation of openssl library will depend on your system configuration. See the value of OpenSSL::Config::DEFAULT_CONFIG_FILE for the location of the file for your host.

See also www.openssl.org/docs/apps/config.html

Constants

The default system configuration file for OpenSSL.

Class Methods

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.

Parses a given string as a blob that contains configuration for OpenSSL.

Parses the configuration data read from io and returns the whole content as a Hash.

Instance Methods

Gets all key-value pairs in a specific section from the current configuration.

Given the following configurating file being loaded:

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

You can get a hash of the specific section like so:

config['default']
  #=> {"foo"=>"bar"}

Retrieves the section and its pairs for the current configuration.

config.each do |section, key, value|
  # ...
end

Gets the value of key from the given section.

Given the following configurating file being loaded:

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

You can get a specific value from the config if you know the section and key like so:

config.get_value('default','foo')
  #=> "bar"
No documentation available

String representation of this configuration object, including the class name and its sections.

Get the names of all sections in the current configuration.

Gets the parsable form of the current configuration.

Given the following configuration being created:

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:

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