Methods
- C
- E
- I
- L
- N
- T
- V
Constants
DEFAULT_PERMISSIONS | = | { :trust_dir => 0700, :trusted_cert => 0600, } |
Attributes
[R] | dir |
Class Public methods
new(dir, permissions = DEFAULT_PERMISSIONS)
Link
Instance Public methods
cert_path(certificate)
Link
Returns the path to the trusted certificate
each_certificate()
Link
Enumerates trusted certificates.
# File lib/rubygems/security/trust_dir.rb, line 27 def each_certificate return enum_for __method__ unless block_given? glob = File.join @dir, '*.pem' Dir[glob].each do |certificate_file| begin certificate = load_certificate certificate_file yield certificate, certificate_file rescue OpenSSL::X509::CertificateError next # HACK warn end end end
issuer_of(certificate)
Link
Returns the issuer certificate of the given certificate
if it
exists in the trust directory.
load_certificate(certificate_file)
Link
Loads the given certificate_file
name_path(name)
Link
Returns the path to the trusted certificate with the given ASN.1
name
trust_cert(certificate)
Link
Add a certificate to trusted certificate list.
verify()
Link
Make sure the trust directory exists. If it does exist, make sure it's actually a directory. If not, then create it with the appropriate permissions.
# File lib/rubygems/security/trust_dir.rb, line 91 def verify if File.exist? @dir then raise Gem::Security::Exception, "trust directory #{@dir} is not a directory" unless File.directory? @dir FileUtils.chmod 0700, @dir else FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir] end end