You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
880 B
50 lines
880 B
module Fixture
|
|
module OpenSSL
|
|
module EC
|
|
def type
|
|
:ecc
|
|
end
|
|
|
|
def size
|
|
self.group.degree
|
|
end
|
|
|
|
def curve
|
|
self.group.curve_name
|
|
end
|
|
|
|
def to_s
|
|
"ECC #{self.size} bits (#{self.curve})"
|
|
end
|
|
|
|
def to_h
|
|
{ type: :ecc, curve: self.curve, size: self.size, fingerprint: self.fingerprint, states: self.states }
|
|
end
|
|
|
|
protected
|
|
|
|
include ::CryptCheck::State
|
|
|
|
CHECKS = [
|
|
[:ecc, %i(critical error warning), -> (s) do
|
|
case s.size
|
|
when 0...160
|
|
:critical
|
|
when 160...192
|
|
:error
|
|
when 192...256
|
|
:warning
|
|
else
|
|
false
|
|
end
|
|
end]
|
|
].freeze
|
|
|
|
def available_checks
|
|
CHECKS
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
::OpenSSL::PKey::EC.include Fixture::OpenSSL::EC
|
|
|