Methods
A
D
G
H
L
N
Included Modules
Class Public methods
new(dirpath)
# File sample/openssl/c_rehash.rb, line 9
def initialize(dirpath)
  @dirpath = dirpath
  @fingerprint_cache = @cert_cache = @crl_cache = nil
end
Instance Public methods
add_crl(crl)
# File sample/openssl/c_rehash.rb, line 44
def add_crl(crl)
  File.open(crl_filename(crl), "w") do |f|
    f << crl.to_pem
  end
  hash_dir(true)
end
delete_crl(crl)
# File sample/openssl/c_rehash.rb, line 39
def delete_crl(crl)
  File.unlink(crl_filename(crl))
  hash_dir(true)
end
get_certs(name = nil)
# File sample/openssl/c_rehash.rb, line 23
def get_certs(name = nil)
  if name
    @cert_cache[hash_name(name)]
  else
    @cert_cache.values.flatten
  end
end
get_crls(name = nil)
# File sample/openssl/c_rehash.rb, line 31
def get_crls(name = nil)
  if name
    @crl_cache[hash_name(name)]
  else
    @crl_cache.values.flatten
  end
end
hash_dir(silent = false)
# File sample/openssl/c_rehash.rb, line 14
def hash_dir(silent = false)
  # ToDo: Should lock the directory...
  @silent = silent
  @fingerprint_cache = Hash.new
  @cert_cache = Hash.new
  @crl_cache = Hash.new
  do_hash_dir
end
load_pem_file(filepath)
# File sample/openssl/c_rehash.rb, line 51
def load_pem_file(filepath)
  str = File.read(filepath)
  begin
    OpenSSL::X509::Certificate.new(str)
  rescue
    begin
      OpenSSL::X509::CRL.new(str)
    rescue
      begin
        OpenSSL::X509::Request.new(str)
      rescue
        nil
      end
    end
  end
end