Sha256: 997abeef0f0942bdad9e9666cf6588d723b0bb657cffdbba5372010857eb41fe

Contents?: true

Size: 777 Bytes

Versions: 9

Compression:

Stored size: 777 Bytes

Contents

module Xmldsig
  class Canonicalizer
    attr_accessor :node, :method, :inclusive_namespaces

    def initialize(node, method = nil, inclusive_namespaces = [])
      @node = node
      @method = method
      @inclusive_namespaces = inclusive_namespaces
    end

    def canonicalize
      node.canonicalize(mode(method), inclusive_namespaces)
    end

    private

    def mode(method)
      case method
        when "http://www.w3.org/2001/10/xml-exc-c14n#"
          Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
        when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
          Nokogiri::XML::XML_C14N_1_0
        when "http://www.w3.org/2006/12/xml-c14n11"
          Nokogiri::XML::XML_C14N_1_1
        else
          Nokogiri::XML::XML_C14N_1_0
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
xmldsig-0.2.9 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.8 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.7 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.6 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.5 lib/xmldsig/canonicalizer.rb
xmldsig-fiscalizer-0.2.4 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.4 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.3 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.2 lib/xmldsig/canonicalizer.rb