class Minke::Encryption::Encryption
Public Class Methods
new(private_key_file)
click to toggle source
# File lib/minke/encryption/encryption.rb, line 4 def initialize(private_key_file) @key_file = private_key_file @key = OpenSSL::PKey::RSA.new File.read private_key_file end
Public Instance Methods
decrypt_string(string)
click to toggle source
# File lib/minke/encryption/encryption.rb, line 13 def decrypt_string(string) @key.private_decrypt(Base64.decode64(string)) end
encrypt_string(string)
click to toggle source
# File lib/minke/encryption/encryption.rb, line 9 def encrypt_string(string) Base64.encode64(@key.public_encrypt(string)) end
fingerprint()
click to toggle source
# File lib/minke/encryption/encryption.rb, line 17 def fingerprint SSHKey.new(File.read(@key_file)).md5_fingerprint end