Methods
G
I
M
N
S
V
Included Modules
Constants
CERT_TYPE_SELF_SIGNED = 0
 
CERT_TYPE_OTHER = 1
 
CERT_TYPE_EE = 2
 
Attributes
[R] crl
[R] ee
[R] other_ca
[R] request
[R] self_signed_ca
Class Public methods
new(certs_dir)
# File sample/openssl/certstore.rb, line 15
def initialize(certs_dir)
  @certs_dir = certs_dir
  @c_store = CHashDir.new(@certs_dir)
  @c_store.hash_dir(true)
  @crl_store = CrlStore.new(@c_store)
  @x509store = Store.new
  @self_signed_ca = @other_ca = @ee = @crl = nil

  # Uncomment this line to let OpenSSL to check CRL for each certs.
  # @x509store.flags = V_FLAG_CRL_CHECK | V_FLAG_CRL_CHECK_ALL

  add_path
  scan_certs
end
Instance Public methods
generate_cert(filename)
# File sample/openssl/certstore.rb, line 30
def generate_cert(filename)
  @c_store.load_pem_file(filename)
end
is_ca?(cert)
# File sample/openssl/certstore.rb, line 47
def is_ca?(cert)
  case guess_cert_type(cert)
  when CERT_TYPE_SELF_SIGNED
    true
  when CERT_TYPE_OTHER
    true
  else
    false
  end
end
match_cert(cert1, cert2)
# File sample/openssl/certstore.rb, line 43
def match_cert(cert1, cert2)
  (cert1.issuer.cmp(cert2.issuer) == 0) and cert1.serial == cert2.serial
end
scan_certs()
# File sample/openssl/certstore.rb, line 58
def scan_certs
  @self_signed_ca = []
  @other_ca = []
  @ee = []
  @crl = []
  @request = []
  load_certs
end
verify(cert)
# File sample/openssl/certstore.rb, line 34
def verify(cert)
  error, crl_map = do_verify(cert)
  if error
    [[false, cert, crl_map[cert.subject], error]]
  else
    @x509store.chain.collect { |c| [true, c, crl_map[c.subject], nil] }
  end
end