Class: XmlSig::Signature

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

Overview

An XML signature.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/xml_sig/signature.rb', line 4

def id
  @id
end

#key_infoObject

Returns the value of attribute key_info.



7
8
9
# File 'lib/xml_sig/signature.rb', line 7

def key_info
  @key_info
end

#signature_valueObject

Returns the value of attribute signature_value.



6
7
8
# File 'lib/xml_sig/signature.rb', line 6

def signature_value
  @signature_value
end

#signed_infoObject

Returns the value of attribute signed_info.



5
6
7
# File 'lib/xml_sig/signature.rb', line 5

def signed_info
  @signed_info
end

Instance Method Details

#assertObject



13
14
15
# File 'lib/xml_sig/signature.rb', line 13

def assert
  # raise AssertionError, "An assertion signature must be valid"
end

#objectsObject



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

def objects
  @objects ||= []
end

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the signature



18
19
20
21
22
23
24
25
26
27
# File 'lib/xml_sig/signature.rb', line 18

def to_xml(xml=Builder::XmlMarkup.new)
  attributes = {}
  attributes['Id'] = id unless id.nil?
  attributes['xmlns:ds'] = "http://www.w3.org/2000/09/xmldsig#"
  xml.tag!('ds:Signature', attributes) {
    xml << signed_info.to_xml if signed_info
    xml.tag!('ds:SignatureValue')
    xml.tag!('ds:KeyInfo') if key_info
  }
end