Class: Ronin::Support::Crypto::Key::DH
- Inherits:
-
OpenSSL::PKey::DH
- Object
- OpenSSL::PKey::DH
- Ronin::Support::Crypto::Key::DH
- Includes:
- Methods
- Defined in:
- lib/ronin/support/crypto/key/dh.rb
Overview
Represents an Diffie-Hellman (DH) key.
Class Method Summary collapse
-
.generate(key_size = 1024, generator: nil) ⇒ DH
Generates a new DH key.
Instance Method Summary collapse
-
#g ⇒ OpenSSL::BN
The
g
variable for the DH key. -
#p ⇒ OpenSSL::BN
The
p
variable for the DH key. -
#q ⇒ OpenSSL::BN?
The
q
variable for the DH key. -
#save(path) ⇒ Object
Saves the DH key to the given file.
-
#size ⇒ Integer
The size of the DH key in bits.
Methods included from Methods
Class Method Details
.generate(key_size = 1024, generator: nil) ⇒ DH
Note:
jruby's openssl does not define OpenSSL::PKey::DH.generate
.
See https://github.com/jruby/jruby-openssl/issues/254
Generates a new DH key.
55 56 57 58 59 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 55 def self.generate(key_size=1024, generator: nil) new_key = allocate new_key.send(:initialize_copy,super(key_size,*generator)) new_key end |
Instance Method Details
#g ⇒ OpenSSL::BN
The g
variable for the DH key.
94 95 96 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 94 def g super() end |
#p ⇒ OpenSSL::BN
The p
variable for the DH key.
68 69 70 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 68 def p super() end |
#q ⇒ OpenSSL::BN?
Note:
jruby's openssl does not implement OpenSSL::PKey::DH#q
.
See https://github.com/jruby/jruby-openssl/issues/253
The q
variable for the DH key.
83 84 85 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 83 def q super() unless RUBY_ENGINE == 'jruby' end |
#save(path) ⇒ Object
Saves the DH key to the given file.
114 115 116 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 114 def save(path) super(path) end |
#size ⇒ Integer
The size of the DH key in bits.
104 105 106 |
# File 'lib/ronin/support/crypto/key/dh.rb', line 104 def size p.num_bits end |