Class: WSS4R::Security::Xml::SignatureValue

Inherits:
Object
  • Object
show all
Defined in:
lib/wss4r/security/xml/signature_value.rb

Instance Method Summary collapse

Constructor Details

#initialize(security_token, signed_info) ⇒ SignatureValue

Returns a new instance of SignatureValue.



6
7
8
9
# File 'lib/wss4r/security/xml/signature_value.rb', line 6

def initialize(security_token, signed_info)
	@security_token = security_token
	@signed_info = signed_info
end

Instance Method Details

#process(document) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wss4r/security/xml/signature_value.rb', line 11

def process(document)
	canonicalizer = TransformerFactory::get_instance("http://www.w3.org/2001/10/xml-exc-c14n#")
	#esult = canonicalizer.write_document_node(@signed_info) #Broken
	result = canonicalizer.canonicalize_element(@signed_info)
	signature_value = @security_token.sign_b64(result)
	@signed_info = XPath.first(document, "//ds:SignedInfo", {"ds" => Namespaces::DS})
	signature_value_element = @signed_info.parent().add_element(Names::SIGNATURE_VALUE)
	signature_value.strip!
	signature_value_element.text=(signature_value)
	@signed_info.document()
end