For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

RSA Key-pair

Steps to Generate and Register a Key Pair in Snowflake

Steps to generate and register a key pair in Snowflake

Step 1: Generate and secure RSA key pair

Run the following command sequence to generate an RSA key pair in one step:

mkdir -p ~/.snowflake/keys
cd ~/.snowflake/keys

# Generate encrypted private key (recommended)
openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 des3 -inform PEM -out snowflake_rsa_key.p8

# Or, unencrypted private key (not recommended)
# openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out snowflake_rsa_key.p8 -nocrypt

# Extract public key
openssl rsa -in snowflake_rsa_key.p8 -pubout -out snowflake_rsa_key.pub

# Secure file permissions
chmod 700 ~/.snowflake ~/.snowflake/keys
chmod 600 ~/.snowflake/keys/snowflake_rsa_key.p8 ~/.snowflake/keys/snowflake_rsa_key.pub

When you run the command sequence above, you are prompted for three passwords in order:

  • Encryption password: A new password to encrypt the private key.

  • Verify encryption password: Re-enter the same password to confirm.

  • Passphrase prompt: The passphrase that decrypts the private key during authentication. An unencrypted private key does not require a passphrase.

You can use the same password for all three prompts. Note down the passphrase securely. You need it later when configuring Snowflake authentication.

Step 2: Retrieve the private key

Run the following command to display the private key contents. You use these contents when creating the Secret.

Step 3: Retrieve the public key for Snowflake

Display the public key as a single line to register in Snowflake:

Copy the output string and use it in the next step.

Step 4: Register the public key in Snowflake

Use a Snowflake account with appropriate privileges such as ACCOUNTADMIN or SECURITYADMIN, then run:

Verify that your public key has been registered successfully:

Step 5: (Optional) Verify the key fingerprint

To verify that your registered public key matches your local key, generate a fingerprint:

Compare the fingerprint with the RSA_PUBLIC_KEY_FP in Snowflake (from DESC USER). They must match for authentication to succeed.

Snowflake supports two public keys (RSA_PUBLIC_KEY and RSA_PUBLIC_KEY_2) for key rotation.

  1. Generate a new key pair.

  2. Register the new public key:

  3. Update your DataOS Instance Secret with the new private key.

  4. Remove the old key after successful validation:

Last updated

Was this helpful?