To Nha Notes | July 1, 2022, 8:22 a.m.
Step 1) Generate the Public and private key. You can generate either an encrypted version of the private key or an unencrypted version of the private key.
IMPORTANT: If you are using SnowSQL, the private key must be encrypted, so use the "Encrypted version" method below
a) Unencrypted version
To generate an unencrypted version of private key, use the following command:
$ openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
To generate an unencrypted version of public key, use the following command:
$ openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
b) Encrypted version
To generate an encrypted version of private key, use the following command:
$ openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8
To generate an encrypted version of public key, use the following command:
$ openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
Step 2) Use ACCOUNTADMIN role to Assign the public key to the Snowflake user using ALTER USER. For example:
ALTER USER <username> SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';
Refer :
https://docs.snowflake.net/manuals/user-guide/odbc-parameters.html#using-key-pair-authentication
https://docs.snowflake.com/en/user-guide/key-pair-auth.html#step-1-generate-the-private-key