

You will also need a passphrase, which you must use whenever you use OpenSSL, so make sure to remember it.Īlice generates her set of key pairs with: alice $ openssl genrsa -aes128 -out alice_private.pem 1024 Step 1: Generate key pairsīefore you can encrypt files, you need to generate a pair of keys. To explore file encryption and decryption, imagine two users, Alice and Bob, who want to communicate with each other by exchanging encrypted files using OpenSSL. The tool is usually installed by default by most Linux distributions if not, you can use your package manager to install it: $ cat /etc/fedora-release This demo uses a Fedora machine with OpenSSL installed. OpenSSL is an amazing tool that does a variety of tasks, including encrypting files. Hence the descriptor "key-pair" the set of keys goes hand-in-hand. The only way you can decrypt your sender's encrypted message is by using your private key. If someone wants to communicate sensitive information with you, you can send them your public key, which they can use to encrypt their messages or files before sending them to you. The other, the private key, is supposed to be a secret and never shared. One is the public key and can be freely shared with anyone you want to communicate with secretly. Public-key encryption uses two sets of keys, called a key pair. Webinar: Automating system security and compliance with a standard operating system.Once the private key has been decrypted, open the file and you should not see the text ENCRYPTED anymore.Run the open ssl command to decrypt the file $ openssl rsa -in -out Įnter pass phrase for encrypted_private.key:.To decrypt the private key from the terminal: pem file, you can simply copy the text between and including the -BEGIN ENCRYPTED PRIVATE KEY- and -END ENCRYPTED PRIVATE KEY- and save it into a new file. You should see the text ENCRYPTED if the private key is encrypted. pem file) using a text editor or command line. When installing a SSL certificate with a private key that is encrypted with a passphrase, you must decrypt the private key first. You can identify whether a private key is encrypted or not by opening the private key (.key or.
