Class: Verifier

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

Class Method Summary collapse

Class Method Details

.verify(document, cert) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/verifier.rb', line 8

def self.verify(document, cert)    
  document = Nokogiri::XML(document.to_s, &:noblanks)
  signed_info_node = document.at_xpath("/soap:Envelope/soap:Header/wsse:Security/ds:Signature/ds:SignedInfo",  {ds: 'http://www.w3.org/2000/09/xmldsig#', wsse: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", soap:"http://schemas.xmlsoap.org/soap/envelope/"})


  #revisar que digest coincida
  if !check_digest(document, signed_info_node)       
     return false
  end 

  if !check_signature(document, signed_info_node, cert)       
     return false
  end 

  
  true
end