Class: SEFAZ::Utils::Signer
- Inherits:
-
Object
- Object
- SEFAZ::Utils::Signer
- Defined in:
- lib/sefaz/utils/signer.rb
Overview
Classe base de assinatura de XML da biblioteca
Instance Method Summary collapse
-
#initialize(xml) ⇒ Signer
constructor
A new instance of Signer.
- #sign!(cert, key) ⇒ Object
- #to_xml ⇒ Object
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_xml ⇒ Object
18 19 20 |
# File 'lib/sefaz/utils/signer.rb', line 18 def to_xml return @doc.canonicalize end |