Snowflake-Labs / sqltools-snowflake-driver

A Snowflake driver for the SQLTools VSCode extension.
MIT License
36 stars 16 forks source link

Key Pair didn't work - UNKNOWN_ALGORITHM #53

Open kardizzone opened 2 years ago

kardizzone commented 2 years ago

It seems PKCS8 is not supported? It was the default suggested by Snowflake when following their instructions here: https://docs.snowflake.com/en/user-guide/key-pair-auth.html

Error output from VS Code is:

[1661205581755] INFO (ls): Connection instance created for SFKeyPair. ns: "conn-manager" [1661205581756] ERROR (ls): Connecting error: {"code":-32001,"data":{"driver":"Snowflake","driverOptions":{}},"name":"Error"} ns: "conn-manager" [1661205581757] ERROR (ext): ERROR: Error opening connection error:13000077:PKCS8 routines:OPENSSL_internal:UNKNOWN_ALGORITHM, {"code":-32001,"data":{"driver":"Snowflake","driverOptions":{}}} ns: "error-handler"

alexnorton commented 1 year ago

I was able to work around this by converting my encrypted private key to an unencrypted version, and configuring the connection to use that:

openssl pkcs8 -in rsa_key.p8 -topk8 -out rsa_key_unencrypted.p8 -nocrypt
rmenendezm commented 1 year ago

When I try @alexnorton solution I get this other error:

Could not read key from my_rsa_key.p8 8045180501000000:error:1608010C:STORE routines:ossl_store_handle_load_result:unsupported:crypto/store/store_result.c:151: 8045180501000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:341:Global default library context, Algorithm (PBKDF1 : 0), Properties ()