Class: SEFAZ::Utils::Signer

Inherits:
Object
  • Object
show all
Defined in:
lib/sefaz/utils/signer.rb

Overview

Classe base de assinatura de XML da biblioteca

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Signer

Returns a new instance of Signer.



8
9
10
# File 'lib/sefaz/utils/signer.rb', line 8

def initialize(xml)
  @doc = Nokogiri::XML::Document.parse(xml, nil, "utf-8", Nokogiri::XML::ParseOptions::NOBLANKS)
end

Instance Method Details

#sign!(cert, key) ⇒ Object



12
13
14
15
16
# File 'lib/sefaz/utils/signer.rb', line 12

def sign!(cert, key)
  @cert = cert
  @key  = key
  @doc.root.add_child(signature)
end

#to_xmlObject



18
19
20
# File 'lib/sefaz/utils/signer.rb', line 18

def to_xml
  return @doc.canonicalize
end