class Ronin::Support::Crypto::Key::DSA

Represents an DSA key.

@see rubydoc.info/stdlib/openssl/OpenSSL/PKey/DSA.html

@since 1.0.0

@api public

Public Class Methods

generate(key_size=1024) click to toggle source

Generates a new random DSA key.

@param [Integer] key_size

The size of the key in bits.

@return [DSA]

The newly generated key.
Calls superclass method
# File lib/ronin/support/crypto/key/dsa.rb, line 48
def self.generate(key_size=1024)
  # HACK: openssl-3.0.0 will return an OpenSSL::PKey::SAA instance,
  # even though we subclassed OpenSSL::PKey::SAA.
  new_key = allocate
  new_key.send(:initialize_copy,super(key_size))
  new_key
end

Public Instance Methods

g() click to toggle source

The ‘g` variable for the DSA key.

@return [OpenSSL::BN]

@see rubydoc.info/stdlib/openssl/OpenSSL/BN

Calls superclass method
# File lib/ronin/support/crypto/key/dsa.rb, line 85
def g
  super()
end
p() click to toggle source

The ‘p` variable for the DSA key.

@return [OpenSSL::BN]

@see rubydoc.info/stdlib/openssl/OpenSSL/BN

Calls superclass method
# File lib/ronin/support/crypto/key/dsa.rb, line 63
def p
  super()
end
q() click to toggle source

The ‘q` variable for the DSA key.

@return [OpenSSL::BN]

@see rubydoc.info/stdlib/openssl/OpenSSL/BN

Calls superclass method
# File lib/ronin/support/crypto/key/dsa.rb, line 74
def q
  super()
end
size() click to toggle source

The size of the DSA key in bits.

@return [Integer]

The key size in bits.
# File lib/ronin/support/crypto/key/dsa.rb, line 95
def size
  p.num_bits
end