Class: MCFDI::Key
- Inherits:
-
OpenSSL::PKey::RSA
- Object
- OpenSSL::PKey::RSA
- MCFDI::Key
- Defined in:
- lib/m_cfdi/key.rb
Overview
openssl pkcs8 -inform DER -in file.key -passin pass:password >> file.pem
Instance Method Summary collapse
-
#initialize(file, password = nil) ⇒ Key
constructor
A new instance of Key.
- #seal(invoice) ⇒ Object
Constructor Details
#initialize(file, password = nil) ⇒ Key
Returns a new instance of Key.
6 7 8 9 10 11 |
# File 'lib/m_cfdi/key.rb', line 6 def initialize(file, password=nil) if file.is_a? String file = File.read(file) end super file, password end |
Instance Method Details
#seal(invoice) ⇒ Object
13 14 15 16 17 |
# File 'lib/m_cfdi/key.rb', line 13 def seal(invoice) original_string = invoice.original_string invoice.stamp = Base64::encode64( self.sign(OpenSSL::Digest::SHA1.new, original_string)).gsub(/\n/, '') end |