Class: EasyRSA::DH
- Inherits:
-
Object
- Object
- EasyRSA::DH
- Defined in:
- lib/easyrsa/dh.rb
Defined Under Namespace
Classes: BitLengthToWeak, MissingParameter
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(bits = 1024, &block) ⇒ DH
constructor
A new instance of DH.
Constructor Details
#initialize(bits = 1024, &block) ⇒ DH
Returns a new instance of DH.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/easyrsa/dh.rb', line 7 def initialize(bits=1024, &block) # Generate DH if bits < 1024 raise EasyRSA::DH::BitLengthToWeak, "Please select a bit length greater than 2048. Default is 4096. You chose '#{bits}'" end @dh = OpenSSL::PKey::DH.new(bits) instance_eval(&block) if block_given? end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 |
# File 'lib/easyrsa/dh.rb', line 18 def generate dh = @dh.generate_key! dh.to_pem end |