Enter PEM pass phrase just once
python, python-2.7, twisted
Solution
As suggested by Mikael, you can remove the pass phrase from the Key. Do note that this presents a serious security risk.
To remove the pass phrase from the Key, perform the following steps. Say you have a file called `foo.pem` with the following contents:
-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
Execute the following command:
openssl rsa -in foo.pem -out foo_unencrypted.pem
You will be prompted for the pass phrase, and in return receive a file `foo_unencrypted.pem` that contains the following:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
This file is missing the `BEGIN CERTIFICATE ---- END CERTIFICATE` section from above, so copy-paste it from `foo.pem` to the end of `foo_unencrypted.pem`:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
If you use the file `foo_unencrypted.pem`, you will now no longer be prompted to "Enter PEM pass phrase".
Problem
I have a loop that that run every 30 sec, connects to a SSL server (reactor.connectSSL()), send a message (self.transport.write(msg)) and then disconnect (self.transport.loseConnection()). The issue is that it asks "Enter PEM pass phrase" each time the loop try to connect. Is it possible to enter it just once?