Generating a private key for Snowflake authentication

To authenticate with Snowflake using key pairs, generate a private key in PKCS#8 format, which Snowflake requires. Choose one of these two methods based on whether you want an unencrypted or encrypted private key.

  1. Generate an unencrypted private key:
    1. Use this command to create a 2048-bit RSA private key in PKCS#8 format without encryption: openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out .p8 -nocrypt.
    2. Replace <fileName> with the required output filename.
    3. Ensure the key is in PKCS#8 format, as required by Snowflake.
  2. Generate an encrypted private key:
    1. Use this command to create a 2048-bit RSA private key and encrypt it using AES-256-CBC with 2048 iterations: openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 | openssl pkcs8 -topk8 -v2 aes-256-cbc -iter 2048 -out .p8
    2. Replace <fileName> with the required output filename.
    3. Specify a passphrase to encrypt the key.
    4. Ensure the key is in PKCS#8 format, as required by Snowflake.