repository-secrets.rb
#Generates a public key pair and writes out the file names based on the
#fingerprint of the public key.
Generates a public key pair and writes out the file names based on the
fingerprint of the public key.
Generates a public key pair and writes out the file names based on the fingerprint of the public key .
def generate_fingerprinted_key_pair(destination, bits)
  verbose 3, "generate_fingerprinted_key_pair()"
  verbose 1, "Generating new key pair."
  rsa_key = OpenSSL::PKey::RSA.new(bits)
  private_key = rsa_key.to_s
  public_key = rsa_key.public_key.to_pem.to_s
  fingerprint = fingerprint(public_key)
  verbose 1, "Writing out private key: #{destination + fingerprint}"
  f = File.open(destination + fingerprint, "w")
  f.write(private_key)
  f.close()
  verbose 1, "Writing out public key: #{destination + fingerprint}.pub"
  f = File.open(destination + fingerprint + ".pub", "w")
  f.write(public_key)
  f.close()
  verbose 3, "  returns #{fingerprint}"
  return fingerprint
end
def generate_fingerprinted_key_pair ( destination , bits ) verbose 3 , "generate_fingerprinted_key_pair()" verbose 1 , "Generating new key pair." rsa_key = OpenSSL :: PKey :: RSA . new ( bits ) private_key = rsa_key . to_s public_key = rsa_key . public_key . to_pem . to_s fingerprint = fingerprint ( public_key ) verbose 1 , "Writing out private key: #{destination + fingerprint}" f = File . open ( destination + fingerprint , "w" ) f . write ( private_key ) f . close ( ) verbose 1 , "Writing out public key: #{destination + fingerprint}.pub" f = File . open ( destination + fingerprint + ".pub" , "w" ) f . write ( public_key ) f . close ( ) verbose 3 , "  returns #{fingerprint}" return fingerprint end
Generates a public key pair and writes out the file names based on the
fingerprint of the public key.
Generates a public key pair and writes out the file names based on the fingerprint of the public key .
#write out the private key #write out the public key
destination
bits