summaryrefslogtreecommitdiff
path: root/lib/saml/kit/cli/commands/certificate.rb
blob: c84c4b10657545a00ed07d08775ae068c80a958c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module Saml
  module Kit
    module Cli
      module Commands
        class Certificate < Thor
          desc 'keypair', 'Create a key pair using a self signed certificate.'
          method_option(
            :format,
            default: 'pem',
            required: false,
            enum: %w[pem env]
          )
          method_option :passphrase, default: nil, required: false
          def keypair
            GenerateKeyPair.new(
              passphrase: options[:passphrase],
              format: options[:format]
            ).run(self)
          end

          desc 'dump', 'Dump the details of a X509 Certificate.'
          def dump(raw)
            CertificateReport.new(raw).print(self)
          end
        end
      end
    end
  end
end