snowflakedb / snowflake-kafka-connector

Snowflake Kafka Connector (Sink Connector)
Apache License 2.0
140 stars 98 forks source link

Exception: Invalid encrypted private key or passphrase Error Code: 0018 #1006

Open abhishekkh opened 5 days ago

abhishekkh commented 5 days ago

I am running a snowflake sink connector using strimzi operator and am unable to get past this error.

Connector config:

    snowflake.private.key: "${file:/opt/kafka/external-configuration/confluent.conf/snowflake_private_key}"
    snowflake.private.key.passphrase: "${file:/opt/kafka/external-configuration/confluent.conf/snowflake_private_key_passphrase}"

Verified the secrets are present in those file paths in the below format:

private_key

-----BEGIN ENCRYPTED PRIVATE KEY-----
64 characters per line with a new line char at the end.
-----END ENCRYPTED PRIVATE KEY-----

private_key_passhprase Single line

Error:

Caused by: com.snowflake.kafka.connector.internal.SnowflakeKafkaConnectorException: [SF_KAFKA_CONNECTOR] Exception: Invalid encrypted private key or passphrase
Error Code: 0018
Detail: failed to decrypt private key. Please verify input private key and passphrase. Snowflake Kafka Connector only supports encryption algorithms in FIPS 140-2
Message: unable to decode base64 string: invalid characters encountered in base64 data
org.bouncycastle.util.encoders.Base64.decode(Unknown Source)
org.bouncycastle.util.io.pem.PemReader.loadObject(Unknown Source)
org.bouncycastle.util.io.pem.PemReader.readPemObject(Unknown Source)
org.bouncycastle.openssl.PEMParser.readObject(Unknown Source)
com.snowflake.kafka.connector.internal.EncryptionUtils.parseEncryptedPrivateKey(EncryptionUtils.java:34)
com.snowflake.kafka.connector.internal.InternalUtils.createProperties(InternalUtils.java:195)
com.snowflake.kafka.connector.internal.SnowflakeConnectionServiceFactory$SnowflakeConnectionServiceBuilder.setProperties(SnowflakeConnectionServiceFactory.java:71)
com.snowflake.kafka.connector.SnowflakeSinkConnector.start(SnowflakeSinkConnector.java:115)

I have verified the secrets work using snowsql

snowsql -u USER -a ACCOUNT -h ACCOUNT.us-east-1.snowflakecomputing.com -p 443 --private-key-path private_key_qa -P

Appreciate any help debugging this