Class: OCSPResponseFetch::CLI
- Inherits:
-
Object
- Object
- OCSPResponseFetch::CLI
- Defined in:
- lib/ocsp_response_fetch/cli.rb
Overview
rubocop: disable Metrics/ClassLength
Class Method Summary collapse
Class Method Details
.run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ocsp_response_fetch/cli.rb', line 9 def run subject, opts = issuer = opts[:issuer] ocsp_response = nil begin subject_cert, issuer_cert = read_certs(subject, issuer) fetcher = Fetcher.new(subject_cert, issuer_cert) ocsp_response = fetcher.run rescue OCSPResponseFetch::Error::RevokedError warn 'error: end entity certificate is revoked' exit 1 rescue OCSPResponseFetch::Error::Error => e warn e exit 1 if opts[:strict] exit 0 end warn ocsp_response.to_text if opts[:verbose] if opts[:output].nil? puts ocsp_response.to_der else File.write(opts[:output], ocsp_response.to_der) end end |