How to pass passphrase for private key in client cert session

Hello all, I am currently running API automation where I need to establish client certificate based SSL session. I am trying to use keyword “Create Client Cert Session” to create a session but I am getting below error:

Caused by SSLError(‘Client private key is encrypted, password is required’

Current client private key is protected with passphrase, can you help me how to pass passphrase?

Hi Raghavendra,

I’ve not used this functionality, but if you post your test case that’s not working and the log of the exact errors your getting there is a better chance someone can help you.

Dave.

https://2.python-requests.org/en/master/user/advanced/#client-side-certificates has nice red box that says:

Warning
The private key to your local certificate must be unencrypted.
Currently, Requests does not support using encrypted keys.

So, nothing really can’t be done on Robot side to this. Maybe you could make your own keyword that decrypts the cert first to temporary location, use that temp location then as your key and remove it after its not needed.

1 Like

In case someone runs into this, I just decrypted the file and passed that via robot and everything worked fine.

openssl rsa -in encrypted.file -out decrypted.file
2 Likes

I created an example that creates a PKCS#12 session. With this you don’t need to use the decrypted file.

The example is based on the rpaframework package and its library RPA.HTTP which extends the RequestsLibrary. I will look into making pull requests about this into RequestsLibrary repository. At the moment I am using requests-pkcs12 and I guess contribution would need to be made without that dependency ? @lucagiove

2 Likes