class SSLyze::XML::Certinfo::Certificate::PublicKey

@since 1.2.0

Constants

ALGORITHMS

Public Class Methods

new(node) click to toggle source

Initializes the public-key information.

@param [Nokogiri::XML::Node] node

# File lib/sslyze/xml/certinfo/certificate/public_key.rb, line 23
def initialize(node)
  @node = node
end

Public Instance Methods

algorithm() click to toggle source

The algorithm used to generate the public-key.

@return [:RSA, :DSA, :EC]

@raise [NotImplementedError]

Unrecognized algorithm name.
# File lib/sslyze/xml/certinfo/certificate/public_key.rb, line 35
def algorithm
  unless @algorithm
    name = @node['algorithm']

    @algorithm = ALGORITHMS.fetch(name) do
      raise(notimplementederror,"unknown public-key algorithm: #{name.inspect}")
    end
  end

  return @algorithm
end
curve() click to toggle source

The Elliptical Curve that was used.

@return [Symbol, nil]

The Elliptical Curve, or `nil` if {#algorithm} was not `:EC`.
# File lib/sslyze/xml/certinfo/certificate/public_key.rb, line 63
def curve
  @curve ||= if (curve = @node['curve'])
               curve.to_sym
             end
end
exponent() click to toggle source

The exponent used to generate the public-key

@return [Integer, nil]

# File lib/sslyze/xml/certinfo/certificate/public_key.rb, line 74
def exponent
  @exponent ||= if (exponent = @node['exponent'])
                  exponent.to_i
                end
end
size() click to toggle source

The size of the public-key.

@return [Integer]

The size in bits.
# File lib/sslyze/xml/certinfo/certificate/public_key.rb, line 53
def size
  @size ||= @node['size'].to_i
end