Class: SatMx::Signer Private
- Inherits:
-
Object
- Object
- SatMx::Signer
- Defined in:
- lib/sat_mx/signer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document:, private_key:) ⇒ Signer
constructor
private
A new instance of Signer.
- #sign ⇒ Object private
Constructor Details
#initialize(document:, private_key:) ⇒ Signer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Signer.
11 12 13 14 |
# File 'lib/sat_mx/signer.rb', line 11 def initialize(document:, private_key:) @unsigned_document = Xmldsig::SignedDocument.new(document) @private_key = private_key end |
Class Method Details
.sign(document:, private_key:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/sat_mx/signer.rb', line 7 def self.sign(document:, private_key:) new(document:, private_key:).sign end |
Instance Method Details
#sign ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 |
# File 'lib/sat_mx/signer.rb', line 16 def sign unsigned_document.sign do |data| private_key.sign(OpenSSL::Digest.new("SHA1"), data) end end |