Sha256: fb68d99c6aeb58fb810b222d9a1758875240d76708e976669ebfa678dcfa9000

Contents?: true

Size: 720 Bytes

Versions: 7

Compression:

Stored size: 720 Bytes

Contents

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

    def initialize(node, method, 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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xmldsig-0.2.1 lib/xmldsig/canonicalizer.rb
xmldsig-0.2.0 lib/xmldsig/canonicalizer.rb
xmldsig-0.1.0 lib/xmldsig/canonicalizer.rb
xmldsig-0.0.4 lib/xmldsig/canonicalizer.rb
xmldsig-0.0.3 lib/xmldsig/canonicalizer.rb
xmldsig-0.0.2 lib/xmldsig/canonicalizer.rb
xmldsig-0.0.1 lib/xmldsig/canonicalizer.rb