Sha256: d52cb89b66dbb8a859753d5d520578f08be1cfb93c6563396c3bccb2fec3261c
Contents?: true
Size: 547 Bytes
Versions: 8
Compression:
Stored size: 547 Bytes
Contents
module Encryption class PKey def initialize(data, password = nil) if File.exist?(data) data = File.read(data) end if password.nil? @key = OpenSSL::PKey::RSA.new(data) else @key = OpenSSL::PKey::RSA.new(data, password) end end def to_s @key.to_s end def to_pem(password = nil) if password.nil? or password.empty? return @key.to_pem end cipher = OpenSSL::Cipher::Cipher.new('des3') @key.to_pem(cipher, password) end end end
Version data entries
8 entries across 8 versions & 1 rubygems