Sha256: 517d961674cf6560bd7a2e0aba244a34018eb0009741d4062c86529d8f5e7a38

Contents?: true

Size: 404 Bytes

Versions: 2

Compression:

Stored size: 404 Bytes

Contents

require 'enigma_decrypter/version'
require 'openssl'
require 'base64'

module EnigmaDecrypter
  def self.decrypt(encrypted_key, private_key_path)
    return nil if encrypted_key.to_s.empty? || private_key_path.to_s.empty?
    private_key = File.read(private_key_path)
    rsa_private_key = OpenSSL::PKey::RSA.new(private_key)
    rsa_private_key.private_decrypt(Base64.decode64(encrypted_key))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enigma_decrypter-0.1.2 lib/enigma_decrypter.rb
enigma_decrypter-0.1.1 lib/enigma_decrypter.rb