Class: SignedXml::Reference
- Inherits:
-
Object
- Object
- SignedXml::Reference
- Includes:
- Logging, Transformable
- Defined in:
- lib/signed_xml/reference.rb
Instance Attribute Summary collapse
-
#here ⇒ Object
readonly
Returns the value of attribute here.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #compute_and_set_digest_value ⇒ Object
-
#initialize(here) ⇒ Reference
constructor
A new instance of Reference.
- #is_verified? ⇒ Boolean
Methods included from Logging
Methods included from Transformable
#apply_transforms, #transforms
Constructor Details
#initialize(here) ⇒ Reference
Returns a new instance of Reference.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/signed_xml/reference.rb', line 8 def initialize(here) @here = here uri = here['URI'] case uri when nil, "" @start = here.document.root when /^#/ id = uri.split('#').last raise ArgumentError, "XPointer expressions like #{id} are not yet supported" if id =~ /^xpointer/ # TODO: handle ID attrs with names other than 'ID' @start = here.document.at_xpath("//*[@ID='#{id}']") raise ArgumentError, "no match found for ID #{id}" if @start.nil? else raise ArgumentError, "unsupported Reference URI #{uri}" end @transforms = init_transforms end |
Instance Attribute Details
#here ⇒ Object (readonly)
Returns the value of attribute here.
6 7 8 |
# File 'lib/signed_xml/reference.rb', line 6 def here @here end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
6 7 8 |
# File 'lib/signed_xml/reference.rb', line 6 def start @start end |
Instance Method Details
#compute_and_set_digest_value ⇒ Object
34 35 36 37 |
# File 'lib/signed_xml/reference.rb', line 34 def compute_and_set_digest_value digest_value_node.content = apply_transforms logger.debug "set digest value to [#{digest_value}]" end |
#is_verified? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/signed_xml/reference.rb', line 28 def is_verified? result = apply_transforms == digest_value logger.info "verification failed for digest value [#{digest_value}]" unless result result end |