Class: Moxml::Signature::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/signature/verifier.rb

Overview

Core Validation per spec ยง3.2, with the safe ordering prescribed by Best Practice 1: verify SignatureValue BEFORE running any reference transforms (which could be hostile).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context:, document:, key: nil, key_map: {}, **_options) ⇒ Verifier

Returns a new instance of Verifier.



11
12
13
14
15
16
# File 'lib/moxml/signature/verifier.rb', line 11

def initialize(context:, document:, key: nil, key_map: {}, **_options)
  @context = context
  @document = document
  @key = key
  @key_map = key_map || {}
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



9
10
11
# File 'lib/moxml/signature/verifier.rb', line 9

def context
  @context
end

#documentObject (readonly)

Returns the value of attribute document.



9
10
11
# File 'lib/moxml/signature/verifier.rb', line 9

def document
  @document
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/moxml/signature/verifier.rb', line 9

def key
  @key
end

#key_mapObject (readonly)

Returns the value of attribute key_map.



9
10
11
# File 'lib/moxml/signature/verifier.rb', line 9

def key_map
  @key_map
end

Instance Method Details

#verifyObject



18
19
20
21
22
23
24
# File 'lib/moxml/signature/verifier.rb', line 18

def verify
  Algorithms.load_builtins!
  signatures = find_signatures

  results = signatures.map { |sig_elem| verify_one(sig_elem) }
  VerificationResult.new(results: results)
end