Sha256: beffe74ae85c2fbd37f969bb61c2f976f35b5a7efd14f7e5fa396e31581d7e92
Contents?: true
Size: 750 Bytes
Versions: 1
Compression:
Stored size: 750 Bytes
Contents
require 'openssl' module Rsa::Tools class Generator # call this function if you just want to save it to your database & send string to others def self.key_pairs private_key, public_key = generate_pairs return private_key.to_s, public_key.to_s end # call this function if pem files were wanted def self.pem_pairs(pub_path = nil, pri_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 def self.generate_pairs pri_key = OpenSSL::PKey::RSA.new(2048) return pri_key, pri_key.public_key end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rsa-tools-0.1.0 | lib/rsa/tools/generator.rb |