Skip to content

Instantly share code, notes, and snippets.

@nitschmann
Created August 17, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitschmann/0da9bff7f7bc05f7bc1f9975673fd86d to your computer and use it in GitHub Desktop.
Save nitschmann/0da9bff7f7bc05f7bc1f9975673fd86d to your computer and use it in GitHub Desktop.
Ruby script to generate OpenSSL Key-Pairs
require "openssl"
# could also be different
key_length = 4096
new_key = OpenSSL::PKey::RSA.generate(key_length)
public_key = new_key.public_key
public_key_string = public_key.to_s
private_key = new_key.private_key
private_key_string = private_key.to_s
# continue work with the keys here
# put them either to the command line or neither write them into a file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment