Sha256: 30a96771067043301cde416b01833c9b5495b366a09ff80899f96648fc3bed37

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

module Xmldsig_fiscalizer
  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

1 entries across 1 versions & 1 rubygems

Version Path
xmldsig-fiscalizer-0.2.5 lib/xmldsig_fiscalizer/canonicalizer.rb