class Rsa::Tools::Generator
Public Class Methods
key_pairs()
click to toggle source
call this function if you just want to save it to your database & send string to others
# File lib/rsa/tools/generator.rb, line 7 def self.key_pairs private_key, public_key = generate_pairs return private_key.to_s, public_key.to_s end
pem_pairs(pri_path = nil, pub_path = nil)
click to toggle source
call this function if pem files were wanted
# File lib/rsa/tools/generator.rb, line 13 def self.pem_pairs(pri_path = nil, pub_path = nil) private_key, public_key = generate_pairs open 'keys/private_key.pem', 'w' do |io| io.write private_key.to_pem end open 'keys/public_key.pem', 'w' do |io| io.write public_key.to_pem end end
Private Class Methods
generate_pairs()
click to toggle source
# File lib/rsa/tools/generator.rb, line 20 def self.generate_pairs pri_key = OpenSSL::PKey::RSA.new(2048) return pri_key, pri_key.public_key end