Class: Saml::Kit::Cli::Certificate
- Inherits:
-
Thor
- Object
- Thor
- Saml::Kit::Cli::Certificate
- Defined in:
- lib/saml/kit/cli/certificate.rb
Instance Method Summary collapse
Instance Method Details
#dump(raw) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/saml/kit/cli/certificate.rb', line 33 def dump(raw) certificate = ::Xml::Kit::Certificate.new(raw, use: :unknown) x509 = certificate.x509 print_table [ ["Subject", "Issuer", "Serial", "Not Before", "Not After", "Fingerprint"], [x509.subject, x509.issuer, x509.serial, x509.not_before, x509.not_after, certificate.fingerprint] ] say x509.to_text, :green end |
#keypair ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/saml/kit/cli/certificate.rb', line 8 def keypair passphrase = [:passphrase] format = [:format] generator = ::Xml::Kit::SelfSignedCertificate.new certificate, private_key = generator.create(passphrase: passphrase) if "pem" == format say "** BEGIN PEM Format **", :green print certificate say private_key say "***********************", :green else say "** BEGIN ENV Format **", :green say "X509_CERTIFICATE=" + certificate.inspect say say "PRIVATE_KEY=" + private_key.inspect say "***********************", :green end say say "Private Key Passphrase:", :green say passphrase.inspect end |