ruby/example_code/s3/s3_add_cspk_encrypt_item.rb
def create_public_private_rsa_key_pair_strings
  private_key = OpenSSL::PKey::RSA.new(2048)
  public_key = private_key.public_key
  private_public_key_strings_pair = {
    'private_key_string' => private_key,
    'public_key_string' => public_key
  }
  puts 'The randomly generated 2048-bit RSA private key string is:'
  puts private_public_key_strings_pair['private_key_string']
  puts 'The corresponding 2048-bit public key string is:'
  puts private_public_key_strings_pair['public_key_string']
  puts 'Keep a record of these key strings. You will not be able to properly ' \
  'encrypt and decrypt the contents of objects without these keys.'
  return private_public_key_strings_pair
end
# Generates a random set of corresponding 2048-bit RSA public and
#   private key-pair strings. Call this function if you do not
#   already have a public/private key pair that you want to use to
#   encrypt the object content.
#
# @return [Hash] The generated public and private key-pair strings.
#   You must keep a record of the strings that are reported. You will
#   not be able to properly encrypt and decrypt the contents of
#   objects without these keys.
# @example
#     create_public_private_rsa_key_pair_strings

Generates a random set of corresponding 2048-bit RSA public and
private key-pair strings. Call this function if you do not
already have a public/private key pair that you want to use to
encrypt the object content.
Generates a random set of corresponding 2048 - bit RSA public and private key - pair strings . Call this function if you do not already have a public / private key pair that you want to use to encrypt the object content .
def create_public_private_rsa_key_pair_strings
  private_key = OpenSSL::PKey::RSA.new(2048)
  public_key = private_key.public_key
  private_public_key_strings_pair = {
    'private_key_string' => private_key,
    'public_key_string' => public_key
  }
  puts 'The randomly generated 2048-bit RSA private key string is:'
  puts private_public_key_strings_pair['private_key_string']
  puts 'The corresponding 2048-bit public key string is:'
  puts private_public_key_strings_pair['public_key_string']
  puts 'Keep a record of these key strings. You will not be able to properly ' \
  'encrypt and decrypt the contents of objects without these keys.'
  return private_public_key_strings_pair
end
def create_public_private_rsa_key_pair_strings private_key = OpenSSL :: PKey :: RSA . new ( 2048 ) public_key = private_key . public_key private_public_key_strings_pair = { 'private_key_string' => private_key , 'public_key_string' => public_key } puts 'The randomly generated 2048-bit RSA private key string is:' puts private_public_key_strings_pair [ 'private_key_string' ] puts 'The corresponding 2048-bit public key string is:' puts private_public_key_strings_pair [ 'public_key_string' ] puts 'Keep a record of these key strings. You will not be able to properly ' 'encrypt and decrypt the contents of objects without these keys.' return private_public_key_strings_pair end
Generates a random set of corresponding 2048-bit RSA public and
private key-pair strings.
Generates a random set of corresponding 2048 - bit RSA public and private key - pair strings .
The generated public and private key-pair strings. You must keep a record of the strings that are reported. You will not be able to properly encrypt and decrypt the contents of objects without these keys.
The generated public and private key - pair strings . You must keep a record of the strings that are reported . You will not be able to properly encrypt and decrypt the contents of objects without these keys .
Hash
example
None