Skip to content

Commit

Permalink
Added support for ronin cert-gen --key-type dsa.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Aug 2, 2023
1 parent 5bf4cdc commit 77d6d5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/ronin/cli/commands/cert_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require 'ronin/support/crypto/cert'
require 'ronin/support/crypto/key/rsa'
require 'ronin/support/crypto/key/ec'
require 'ronin/support/crypto/key/dsa'
require 'ronin/support/text/patterns'

require 'ronin/core/cli/logging'
Expand Down Expand Up @@ -47,7 +48,7 @@ module Commands
# -L, --locality NAME The locality for the certificate
# -S, --state XX The two-letter State (ST) code for the certificate
# -C, --country XX The two-letter Country (C) code for the certificate
# -t, --key-type rsa|ec The signing key type
# -t, --key-type rsa|dsa|ec The signing key type
# --generate-key PATH Generates and saves a random key (Default: key.pem)
# -k, --key-file FILE Loads the signing key from the FILE
# -H sha256|sha1|md5, The hash algorithm to use for signing (Default: sha256)
Expand Down Expand Up @@ -149,7 +150,7 @@ class CertGen < Command

option :key_type, short: '-t',
value: {
type: [:rsa, :ec]
type: [:rsa, :dsa, :ec]
},
desc: 'The signing key type'

Expand Down Expand Up @@ -287,12 +288,14 @@ def not_after
# The `--key-type` key class.
#
# @return [Class<Ronin::Support::Key::RSA>,
# Class<Ronin::Support::Key::DSA>,
# Class<Ronin::Support::Key::EC>, nil]
#
def key_class
case options[:key_type]
when :rsa then Support::Crypto::Key::RSA
when :ec then Support::Crypto::Key::EC
when :dsa then Support::Crypto::Key::DSA
end
end

Expand Down
2 changes: 1 addition & 1 deletion man/ronin-cert-gen.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Generates a new X509 certificate.
`-C`, `--country` *XX*
The two-letter Country (C) code for the certificate.

`-t`, `--key-type `rsa`\|`ec`
`-t`, `--key-type `rsa`\|`dsa`\|`ec`
The signing key type.

`--generate-key` *PATH*
Expand Down

0 comments on commit 77d6d5c

Please sign in to comment.