Commit c61984d

mokha <mokha@cisco.com>
2018-02-06 16:48:07
print certificate details.
1 parent 607b852
Changed files (1)
lib
saml
lib/saml/kit/cli/certificate.rb
@@ -28,6 +28,16 @@ module Saml
           say "Private Key Passphrase:", :green
           say passphrase.inspect
         end
+
+        desc "dump", "Dump the details of a X509 Certificate."
+        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]
+          ]
+        end
       end
     end
   end