Generate Keys

The following Ruby encryption example uses the OpenSSL cryptography toolkit.

Generate RSA keys

Generate an RSA private and public key pair:

require 'openssl'
def generate_RSA(bits=2048)
    # Generates an RSA keypair
    # @bits The key length in bits
    OpenSSL::PKey::RSA.new(bits)
end

User Contributed

LaunchKey links to user contributed code as a resource to its community. LaunchKey does not in any way guarantee or warrant the quality and security of these code bases. User contributed code is supported by the creators. If you do find a link from the site to user contributed code that is malicious or inappropriate in any way, please report that link to LaunchKey immediately and we will investigate the claim. Submit any issue to LaunchKey support at https://launchkey.com./support. ×