Snowflake-Labs / sqltools-snowflake-driver

A Snowflake driver for the SQLTools VSCode extension.
MIT License
35 stars 15 forks source link

OpenSSL Unknown Algorithm #41

Open reeseann opened 3 years ago

reeseann commented 3 years ago

Using keypair auth:

[1618273502356] ERROR (ext): ERROR: Error opening connection error:13000077:PKCS8 routines:OPENSSL_internal:UNKNOWN_ALGORITHM, {"code":-32001,"data":{"driver":"Snowflake","driverOptions":{}}}

Private key was generated using LibreSSL 2.8.3 in PKCS8 format

jsteinfort-amd commented 2 years ago

Same error message for me. Key works everywhere else I use it (DBeaver, snowsql, dbt, etc).

sashamitrovich commented 2 years ago

Same here. Anyone found a fix for this?

varun-dc commented 1 year ago

If it's of any help, here's some possible details and possible workaround I found. Below are my notes from a year or so ago, so this is all I can offer, I don't remember other details

Specify the -v2 aes-256-cbc cipher algorithm when generating the private key. This only appears to be required for MacOS and/or LibreSSL (the OpenSSL implementation shipped with MacOS).

openssl genrsa -out snowflake_key 4096
openssl rsa -in snowflake_key -pubout -out snowflake_key.pub
openssl pkcs8 -topk8 -inform pem -in snowflake_key -outform PEM -v2 aes-256-cbc -out snowflake_key.p8

See https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#keypair-authentication-passhrase

And also see Google search results for snowflake macos openssl libressl encrypt.

varun-dc commented 1 year ago

I saw this when I was using "snowflake-sdk" npm module in my project. The fact this also uses it (I haven't used sqltools-snowflake-driver, or know anything about it, was just linked here and wanted to provide some possible help) is a bit suspicious. The root cause points to "snowflake-sdk" by this reasoning.

rmenendezm commented 9 months ago

Has anyone found a workaround to this issue? I still see the same situation:

image