Failed to load the private key based on <PRIVATE KEY>

This error generated by the com.cirruslink.ingest.snowflake.StreamingIngest logger indicates that the private/public key pair for snowflake connection is encrypted.

The key pair must be unencrypted 

You will also see a stack trace similar to the one below:

FINEST|5210/0||26-05-22 18:22:36|net.snowflake.ingest.utils.SFException: Invalid private key, private key should be a valid PEM RSA private key.
FINEST|5210/0||26-05-22 18:22:36|	at net.snowflake.ingest.utils.Utils.parsePrivateKey(Utils.java:244)
FINEST|5210/0||26-05-22 18:22:36|	at net.snowflake.ingest.utils.Utils.createProperties(Utils.java:155)
FINEST|5210/0||26-05-22 18:22:36|	at net.snowflake.ingest.streaming.SnowflakeStreamingIngestClientFactory$Builder.build(SnowflakeStreamingIngestClientFactory.java:57)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.StreamingIngest.getClient(StreamingIngest.java:324)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.StreamingIngest.openChannel(StreamingIngest.java:230)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.SparkplugStreamingIngest.lambda$getChannel$3(SparkplugStreamingIngest.java:372)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.SparkplugStreamingIngest.getChannel(SparkplugStreamingIngest.java:370)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.SparkplugStreamingIngest.insert(SparkplugStreamingIngest.java:150)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.SparkplugStreamingIngest.insert(SparkplugStreamingIngest.java:135)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.StreamingIngest.batchInsert(StreamingIngest.java:295)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.StreamingIngest.batchInsert(StreamingIngest.java:276)
FINEST|5210/0||26-05-22 18:22:36|	at com.cirruslink.iotbridge.snowflake.ingest.StreamingIngest.run(StreamingIngest.java:136)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.lang.Thread.run(Thread.java:840)
FINEST|5210/0||26-05-22 18:22:36|Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : DerValue.getBigIntegerInternal, not expected 48
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:253)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/java.security.KeyFactory.generatePrivate(KeyFactory.java:389)
FINEST|5210/0||26-05-22 18:22:36|	at net.snowflake.ingest.utils.Utils.parsePrivateKey(Utils.java:242)
FINEST|5210/0||26-05-22 18:22:36|	... 18 common frames omitted
FINEST|5210/0||26-05-22 18:22:36|Caused by: java.security.InvalidKeyException: IOException : DerValue.getBigIntegerInternal, not expected 48
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:135)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.pkcs.PKCS8Key.<init>(PKCS8Key.java:95)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.<init>(RSAPrivateCrtKeyImpl.java:162)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(RSAPrivateCrtKeyImpl.java:92)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.rsa.RSAKeyFactory.generatePrivate(RSAKeyFactory.java:352)
FINEST|5210/0||26-05-22 18:22:36|	at java.base/sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:249)
FINEST|5210/0||26-05-22 18:22:36|	... 20 common frames omitted

400 Bad Request

This 400 Bad Request is returned from the Snowflake Streaming endpoint when using the URL configured in your Snowflake Streaming Profile configuration.

This can be caused by a number of configuration errors:

  1. The URL is incorrect or malformed
  2. The user and role are mismatched or incorrect
     
INFO|69731/0||24-04-04 20:48:33|20:48:33.243 [main] INFO  n.s.i.connection.SecurityManager - Successfully created new JWT
INFO|69731/0||24-04-04 20:48:33|20:48:33.245 [main] INFO  n.s.ingest.connection.RequestBuilder - Creating a RequestBuilder with arguments : Account : FU08711, User : IBSNOW_INGEST, Scheme : https, Host : fu08711.east-us-2.azure.snowflakecomputing.com, Port : 443, userAgentSuffix: null
INFO|69731/0||24-04-04 20:48:33|20:48:33.245 [main] INFO  n.s.i.s.i.SnowflakeStreamingIngestClientInternal - [SF_INGEST] Using KEYPAIR_JWT for authorization
INFO|69731/0||24-04-04 20:48:33|20:48:33.261 [main] INFO  n.s.i.s.i.StreamingIngestStage - [SF_INGEST] Refresh Snowflake metadata, client=IBSNOWClient
INFO|69731/0||24-04-04 20:48:33|20:48:33.780 [main] WARN  n.s.i.c.ServiceResponseHandler - 400 Status hit from STREAMING_CLIENT_CONFIGURE, requestId:
INFO|69731/0||24-04-04 20:48:33|20:48:33.862 [main] ERROR c.c.i.snowflake.StreamingIngest - Failed to open the channel for IBSNOW_BridgeInfo
INFO|69731/0||24-04-04 20:48:33|20:48:33.864 [main] ERROR c.c.i.snowflake.StreamingIngest - Failed to insert on topic 'spBv1.0/IBSNOW/NBIRTH/Bridge Info'
INFO|69731/0||24-04-04 20:48:33|java.lang.NullPointerException: null
INFO|69731/0||24-04-04 20:48:33|        at com.cirruslink.iotbridge.snowflake.StreamingIngest.insert(StreamingIngest.java:136)
  • No labels