Easiest is via Linux subsystem on Windows, but there would also be a way in Windows
#!/bin/bash
PASSPHRASE='YourStrongPassphrase123!'
# 1. Generate encrypted RSA private key in PKCS#8 format (.p8)
openssl genpkey \
-algorithm RSA \
-pkeyopt rsa_keygen_bits:2048 \
-aes-256-cbc \
-pass pass:"$PASSPHRASE" \
-out rsa_key.p8
# 2. Extract the public key
openssl rsa \
-in rsa_key.p8 \
-passin pass:"$PASSPHRASE" \
-pubout \
-out rsa_key.pub
# 3. Strip header/footer for Snowflake
grep -v "^-----" rsa_key.pub | tr -d '\n'
# Empty the password variable and remove recent session history
unset PASSPHRASE
history -c
Save the p8 (or show via cat rsa_key.p8), the public key and the passphrase securely and delete the files on the linux machine afterwards.
In Snowflake you need to attach the public key to a user like
ALTER USER myuser SET RSA_PUBLIC_KEY='MIIBIjANBgkq...your key content...';And then you can use your snowflake connection string
account=myaccount;user=myuser;db=testdb;schema=abc;AUTHENTICATOR=snowflake_jwt;PRIVATE_KEY_FILE=C:\temp\rsa_key.p8;PRIVATE_KEY_PWD=YourStrongPassphrase123!