Class: Ronin::Support::Crypto::Key::DSA

Inherits:
OpenSSL::PKey::DSA
  • Object
show all
Includes:
Methods
Defined in:
lib/ronin/support/crypto/key/dsa.rb

Overview

Represents an DSA key.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Methods

included, #save

Class Method Details

.generate(key_size = 1024) ⇒ DSA

Generates a new random DSA key.

Parameters:

  • key_size (Integer) (defaults to: 1024)

    The size of the key in bits.

Returns:

  • (DSA)

    The newly generated key.

Since:

  • 1.0.0



48
49
50
51
52
53
54
# 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

Instance Method Details

#gOpenSSL::BN

The g variable for the DSA key.

Returns:

  • (OpenSSL::BN)

See Also:

Since:

  • 1.0.0



85
86
87
# File 'lib/ronin/support/crypto/key/dsa.rb', line 85

def g
  super()
end

#pOpenSSL::BN

The p variable for the DSA key.

Returns:

  • (OpenSSL::BN)

See Also:

Since:

  • 1.0.0



63
64
65
# File 'lib/ronin/support/crypto/key/dsa.rb', line 63

def p
  super()
end

#qOpenSSL::BN

The q variable for the DSA key.

Returns:

  • (OpenSSL::BN)

See Also:

Since:

  • 1.0.0



74
75
76
# File 'lib/ronin/support/crypto/key/dsa.rb', line 74

def q
  super()
end

#sizeInteger

The size of the DSA key in bits.

Returns:

  • (Integer)

    The key size in bits.

Since:

  • 1.0.0



95
96
97
# File 'lib/ronin/support/crypto/key/dsa.rb', line 95

def size
  p.num_bits
end