class Inspec::Resources::DhParams
Public Class Methods
new(filename)
click to toggle source
# File lib/inspec/resources/dh_params.rb, line 27 def initialize(filename) @dh_params_path = filename @dh_params = OpenSSL::PKey::DH.new read_file_content(@dh_params_path) end
Public Instance Methods
dh_params?()
click to toggle source
it { should be_dh_params }
# File lib/inspec/resources/dh_params.rb, line 33 def dh_params? !@dh_params.nil? end
generator()
click to toggle source
its('generator') { should eq 2 }
# File lib/inspec/resources/dh_params.rb, line 38 def generator return if @dh_params.nil? @dh_params.g.to_i end
modulus()
click to toggle source
its('modulus') { should eq '00:91:a0:15:89:e5:bc:38:93:12:02:fc:…' }
# File lib/inspec/resources/dh_params.rb, line 45 def modulus return if @dh_params.nil? "00:" + @dh_params.p.to_s(16).downcase.scan(/.{2}/).join(":") end
pem()
click to toggle source
its('pem') { should eq '—–BEGIN DH PARAMETERS…' }
# File lib/inspec/resources/dh_params.rb, line 52 def pem return if @dh_params.nil? @dh_params.to_pem end
prime_length()
click to toggle source
its('prime_length') { should be 2048 }
# File lib/inspec/resources/dh_params.rb, line 59 def prime_length return if @dh_params.nil? @dh_params.p.num_bits end
text()
click to toggle source
its('text') { should eq 'human-readable-text' }
# File lib/inspec/resources/dh_params.rb, line 66 def text return if @dh_params.nil? @dh_params.to_text end
to_s()
click to toggle source
# File lib/inspec/resources/dh_params.rb, line 79 def to_s "dh_params #{@dh_params_path}" end
valid?()
click to toggle source
it { should be_valid }
# File lib/inspec/resources/dh_params.rb, line 73 def valid? return if @dh_params.nil? @dh_params.params_ok? end