Module: Crypto

Defined in:
lib/crypto.rb

Defined Under Namespace

Classes: Key

Class Method Summary collapse

Class Method Details

.create_keys(priv, pub, bits) ⇒ Object



5
6
7
8
9
10
# File 'lib/crypto.rb', line 5

def self.create_keys(priv, pub, bits)
  private_key = OpenSSL::PKey::RSA.new(bits)
  File.open(priv, "w+") { |fp| fp << private_key.to_s }
  File.open(pub,  "w+") { |fp| fp << private_key.public_key.to_s }
  private_key
end