Class: XmlSig::SignedInfo
- Inherits:
-
Object
- Object
- XmlSig::SignedInfo
- Defined in:
- lib/xml_sig/signed_info.rb
Instance Attribute Summary collapse
-
#canonicalization_method ⇒ Object
Returns the value of attribute canonicalization_method.
-
#id ⇒ Object
Returns the value of attribute id.
-
#signature_method ⇒ Object
Returns the value of attribute signature_method.
Instance Method Summary collapse
Instance Attribute Details
#canonicalization_method ⇒ Object
Returns the value of attribute canonicalization_method.
4 5 6 |
# File 'lib/xml_sig/signed_info.rb', line 4 def canonicalization_method @canonicalization_method end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/xml_sig/signed_info.rb', line 3 def id @id end |
#signature_method ⇒ Object
Returns the value of attribute signature_method.
5 6 7 |
# File 'lib/xml_sig/signed_info.rb', line 5 def signature_method @signature_method end |
Instance Method Details
#references ⇒ Object
7 8 9 |
# File 'lib/xml_sig/signed_info.rb', line 7 def references @references ||= [] end |
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/xml_sig/signed_info.rb', line 17 def to_xml(xml=Builder::XmlMarkup.new) attributes = {} attributes['Id'] = id unless id.nil? xml.tag!('ds:SignedInfo', attributes) { xml << canonicalization_method.to_xml unless canonicalization_method.nil? xml << signature_method.to_xml unless signature_method.nil? references.each { |reference| xml << reference.to_xml } } end |
#validate ⇒ Object
11 12 13 14 15 |
# File 'lib/xml_sig/signed_info.rb', line 11 def validate raise ValidationError, "Canonicalization method is required" if canonicalization_method.nil? raise ValidationError, "Signature method is required" if signature_method.nil? raise ValidationError, "At least one reference is required" if references.empty? end |