Michael Aquilina
Michael Aquilina

Reputation: 5520

How do you convert an unencrypted PEM file to an encrypted format

I have an unencrypted PEM file I want to secure by requiring a passphrase to unlock (to prevent issues in the case where it is possibly stolen).

How would one go about converting it using a terminal command?

Upvotes: 0

Views: 720

Answers (1)

Aaryn Tonita
Aaryn Tonita

Reputation: 490

I believe this tutorial contains the information you are looking for, more or less, I believe you just need to remove the -passing part:

$ mv test_rsa_key test_rsa_key.old
$ openssl pkcs8 -topk8 -v2 des3 \
    -in test_rsa_key.old \
    -out test_rsa_key -passout 'pass:super secret passphrase'

In any case, openssl is the tool you want to use.

Upvotes: 1

Related Questions