Sha256: c6c35d125cb84f165584b72fe094a8830bf2baadac6a6b9680796c4008a240d9

Contents?: true

Size: 1012 Bytes

Versions: 8

Compression:

Stored size: 1012 Bytes

Contents

module Xmldsig
  class Canonicalizer
    class UnsupportedException < Xmldsig::Error
    end
    attr_accessor :node, :method, :inclusive_namespaces, :with_comments

    def initialize(node, method = nil, inclusive_namespaces = nil, with_comments = false)
      @node                 = node
      @method               = method
      @inclusive_namespaces = inclusive_namespaces
      @with_comments        = with_comments
    end

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

    private

    def mode(method)
      case method
      when "http://www.w3.org/2001/10/xml-exc-c14n#",
           "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
        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

8 entries across 8 versions & 1 rubygems

Version Path
xmldsig-0.7.0 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.6 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.5 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.4 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.3 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.2 lib/xmldsig/canonicalizer.rb
xmldsig-0.6.1 lib/xmldsig/canonicalizer.rb
xmldsig-0.5.1 lib/xmldsig/canonicalizer.rb