davidhcoe commented on code in PR #1199:
URL: https://github.com/apache/arrow-adbc/pull/1199#discussion_r1358624475
##########
go/adbc/driver/snowflake/snowflake_database.go:
##########
@@ -328,13 +330,28 @@ func (d *databaseImpl) SetOptions(cnOptions
map[string]string) error {
}
}
- d.cfg.PrivateKey, err = x509.ParsePKCS1PrivateKey(data)
+ var block []byte
+ if strings.Contains(string(data), "PRIVATE KEY") {
+ b, _ := pem.Decode(data)
+ block = b.Bytes
+ } else {
+ block = data
+ }
+
+ var key any
+ key, err = x509.ParsePKCS1PrivateKey(block)
+ if err != nil && strings.Contains(err.Error(), "use
ParsePKCS8PrivateKey instead") {
+ key, err = x509.ParsePKCS8PrivateKey(block)
+ }
+
if err != nil {
return adbc.Error{
Msg: "failed parsing private key file
'" + v + "': " + err.Error(),
Code: adbc.StatusInvalidArgument,
}
}
+
+ d.cfg.PrivateKey = key
Review Comment:
see
https://github.com/snowflakedb/gosnowflake/blob/dfb1c18624ebd4023e27839cd32a51955758bd75/priv_key_test.go#L52
for an example
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]