Class: SatMx::Signer
- Inherits:
-
Object
- Object
- SatMx::Signer
- Defined in:
- lib/sat_mx/signer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document:, private_key:) ⇒ Signer
constructor
A new instance of Signer.
- #sign ⇒ Object
Constructor Details
#initialize(document:, private_key:) ⇒ Signer
Returns a new instance of Signer.
10 11 12 13 |
# File 'lib/sat_mx/signer.rb', line 10 def initialize(document:, private_key:) @unsigned_document = Xmldsig::SignedDocument.new(document) @private_key = private_key end |
Class Method Details
.sign(document:, private_key:) ⇒ Object
6 7 8 |
# File 'lib/sat_mx/signer.rb', line 6 def self.sign(document:, private_key:) new(document:, private_key:).sign end |
Instance Method Details
#sign ⇒ Object
15 16 17 18 19 |
# File 'lib/sat_mx/signer.rb', line 15 def sign unsigned_document.sign do |data| private_key.sign(OpenSSL::Digest.new("SHA1"), data) end end |