Module: Crypto

Defined in:
lib/crypto.rb

Defined Under Namespace

Classes: Key

Class Method Summary collapse

Class Method Details

.create_keys(priv = "rsa_key", pub = "#{priv}.pub", bits = 4096) ⇒ Object



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

def self.create_keys(priv = "rsa_key", pub = "#{priv}.pub", bits = 4096)
  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