Method: LibGems::Security.add_trusted_cert
- Defined in:
- lib/libgems/security.rb
.add_trusted_cert(cert, opt = {}) ⇒ Object
Add certificate to trusted cert list.
Note: At the moment these are stored in OPT, although that directory may change in the future.
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
# File 'lib/libgems/security.rb', line 755 def self.add_trusted_cert(cert, opt = {}) opt = OPT.merge(opt) # get destination path path = LibGems::Security::Policy.trusted_cert_path(cert, opt) # verify trust directory (can't write to nowhere, you know) verify_trust_dir(opt[:trust_dir], opt[:perms][:trust_dir]) # write cert to output file File.open(path, 'wb') do |file| file.chmod(opt[:perms][:trusted_cert]) file.write(cert.to_pem) end # return nil nil end |