Class: XMLSecurity::BaseDocument
- Inherits:
- 
      REXML::Document
      
        - Object
- REXML::Document
- XMLSecurity::BaseDocument
 
- Defined in:
- lib/xml_security.rb
Direct Known Subclasses
Constant Summary collapse
- C14N =
- "http://www.w3.org/2001/10/xml-exc-c14n#"
- DSIG =
- "http://www.w3.org/2000/09/xmldsig#"
Instance Method Summary collapse
Instance Method Details
#algorithm(element) ⇒ Object
| 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # File 'lib/xml_security.rb', line 55 def algorithm(element) algorithm = element if algorithm.is_a?(REXML::Element) algorithm = element.attribute("Algorithm").value algorithm = algorithm && algorithm =~ /sha(.*?)$/i && $1.to_i end case algorithm when 256 then OpenSSL::Digest::SHA256 when 384 then OpenSSL::Digest::SHA384 when 512 then OpenSSL::Digest::SHA512 else OpenSSL::Digest::SHA1 end end | 
#canon_algorithm(element) ⇒ Object
| 41 42 43 44 45 46 47 48 49 50 51 52 53 | # File 'lib/xml_security.rb', line 41 def canon_algorithm(element) algorithm = element if algorithm.is_a?(REXML::Element) algorithm = element.attribute('Algorithm').value end case algorithm when "http://www.w3.org/2001/10/xml-exc-c14n#" then Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" then Nokogiri::XML::XML_C14N_1_0 when "http://www.w3.org/2006/12/xml-c14n11" then Nokogiri::XML::XML_C14N_1_1 else Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 end end |