[Python] python snowflake.connector & rsa private_key_file issue

Discussão em 'Python' iniciado por Stack, Fevereiro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I meet an issue when trying to use snowflake.connector with an RSA pkcs8 key with passphrase.

    When I try this code, with this kind of RSA Key: openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8

    import snowflake.connector as sc

    private_key_file = 'config/rsa_key.p8'
    private_key_file_pwd = input(f"Give to me the passphrase of the key {private_key_file}: ")

    conn_params = {
    'account': 'SFK_ORG-SRF_ISTANCE',
    'user': 'TEST_RSA',
    'private_key_file': private_key_file,
    'private_key_file_pwd': private_key_file_pwd,
    'warehouse': 'MY_WH',
    'database': 'MY_DB',
    'schema': 'MY_SCHEMA',
    'role': 'USER_ROLE'
    }

    conn = sc.connect(**conn_params)



    I get this error:

    TypeError: Password was given but private key is not encrypted.

    Why?

    Continue reading...

Compartilhe esta Página