-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
I'm getting following error while trying to connect to mongodb server from golang application kubernetes pod.
tls: private key does not match public key
I'm using mongo-go-driver version 1.4.1
Key is RSA encrypted. ----BEGIN RSA PRIVATE KEY---- Proc-Type: 4,ENCRYPTED DEK-Info: ..
PFB application code to connect
{{ m.context, _ = context.WithTimeout(context.Background(), 30*time.Second)}}
{{}}
{{ certFilePath := <path>}}
{{ keyPassword := <password>}}
{{}}
{{ uri := "mongodb://user:password@<mongoserver>:27017/?authSource=<dbname>&authMechanism=scram-sha-1&connect=direct&ssl=true&sslClientCertificateKeyFile=%s&sslClientCertificateKeyPassword=%s&sslInsecure=true&sslAllowInvalidCertificates=true" uri = fmt.Sprintf(uri, certFilePath, keyPassword)}}
{{}}
{{ log.Println("ConnectDB: creating mongo client new")}}
{{ clientOptions := []*options.ClientOptions
}}
{{}}
{{ log.Println("ConnectDB: connecting client") m.client, err = mongo.Connect(m.context, clientOptions...)if nil != err
}}
Same key and certs are working fine when connecting using Robo 3T or Studio 3T
Please help me in resolving key mismatch error.