要約
OpenSSL の設定ファイルを表すクラスです。
OpenSSL の設定ファイルは、キーと文字列を対応付けた単純な構造をしています。また、キーはセクションによってグループ分けされています。どのセクションにも属さないグローバルなキーを作ることもできます。
デフォルトの設定ファイルを読み込む例require 'openssl'
conf = OpenSSL::Config.load(OpenSSL::Config::DEFAULT_CONFIG_FILE)
p conf.sections # => ["req_distinguished_name", "req_attributes", "proxy_cert_ext", "policy_anything", "CA_default", ...]
p conf.get_value("", "HOME") # => "."
p conf.get_value("CA_default", "default_days") # => "365"
目次
継承しているメソッド
- Enumerableから継承しているメソッド
-
- all?
- any?
- chain
- chunk
- chunk_while
- collect
- collect_concat
- compact
- count
- cycle
- detect
- drop
- drop_while
- each_cons
- each_entry
- each_slice
- each_with_index
- each_with_object
- entries
- filter
- filter_map
- find
- find_all
- find_index
- first
- flat_map
- grep
- grep_v
- group_by
- include?
- inject
- lazy
- map
- max
- max_by
- member?
- min
- min_by
- minmax
- minmax_by
- none?
- one?
- partition
- reduce
- reject
- reverse_each
- select
- slice_after
- slice_before
- slice_when
- sort
- sort_by
- sum
- take
- take_while
- tally
- to_a
- to_h
- to_set
- uniq
- zip
特異メソッド
load(filename = nil) -> OpenSSL::Config[permalink][rdoc][edit]new(filename = nil) -> OpenSSL::Config-
OpenSSL::Config オブジェクトを生成します。
filename で指定したファイルから設定データを読みこみます。
filename を省略した場合は空のオブジェクトが生成されます。
- [PARAM]
filename: - ファイル名文字列
- [EXCEPTION]
OpenSSL::ConfigError: - 設定ファイルの文法が正しくない場合に発生します
- [PARAM]
parse(str) -> OpenSSL::Config[permalink][rdoc][edit]-
文字列から OpenSSL::Config オブジェクトを生成します。
- [PARAM]
str: - 設定ファイルデータ
- [PARAM]
インスタンスメソッド
each {|section, key, value| ... } -> self[permalink][rdoc][edit]-
オブジェクトに含まれる全ての設定情報を順にブロックに渡し呼び出します。
渡される値は、セクションを表す文字列、キーを表す文字列、キーに割り当てられた値の文字列、の3つです。
require 'openssl' conf = OpenSSL::Config.load(OpenSSL::Config::DEFAULT_CONFIG_FILE) conf.each{|section, key, value| p [section, key, value]} # => ["req_distinguished_name", "countryName", "Country Name (2 letter code)"] # => ["req_distinguished_name", "countryName_default", "AU"] # => ["req_distinguished_name", "countryName_min", "2"] # => : get_value(section, name) -> String | nil[permalink][rdoc][edit]-
オブジェクトが持っている設定情報を返します。
キーに対応する設定情報がない場合は nil を返します。
- [PARAM]
section: - セクションを表す文字列。"" を渡すことでグローバルな設定情報を読むことができます。
- [PARAM]
name: - キーを表す文字列
- [PARAM]
定数
DEFAULT_CONFIG_FILE -> String[permalink][rdoc][edit]-
デフォルトの設定ファイル名を返します。