Class: Saml::Kit::Cli::GenerateKeyPair

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/cli/generate_key_pair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(passphrase:, format:) ⇒ GenerateKeyPair

Returns a new instance of GenerateKeyPair.



9
10
11
12
# File 'lib/saml/kit/cli/generate_key_pair.rb', line 9

def initialize(passphrase:, format:)
  @passphrase = passphrase
  @format = format
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



7
8
9
# File 'lib/saml/kit/cli/generate_key_pair.rb', line 7

def format
  @format
end

#passphraseObject (readonly)

Returns the value of attribute passphrase.



7
8
9
# File 'lib/saml/kit/cli/generate_key_pair.rb', line 7

def passphrase
  @passphrase
end

Instance Method Details

#run(shell) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/saml/kit/cli/generate_key_pair.rb', line 14

def run(shell)
  certificate, private_key = generate
  if pem?
    shell.say certificate
    shell.say private_key
  else
    shell.say 'X509_CERTIFICATE=' + certificate.inspect
    shell.say 'PRIVATE_KEY=' + private_key.inspect
  end
  shell.say 'Private Key Passphrase:', :green
  shell.say passphrase.inspect
end