OpenSSL is a powerful command-line tool used for encryption, hashing, certificates, and secure connections. It provides many useful commands for working with files, passwords, keys, and SSL/TLS connections from the Termux terminal. OpenSSL is useful for beginners who want to learn basic encryption and security commands on Android.
Here’s what you can do with OpenSSL in Termux:
- Create file hashes.
- Encrypt and decrypt files.
- Generate random data.
- Create encryption keys.
- Check SSL certificates.
- Test HTTPS connections.
- Encode and decode Base64 data.
- Learn basic cryptography.
Install OpenSSL in Termux
Below are the simple commands to install OpenSSL in Termux. Copy and run each command one by one to install the tool.
Update Termux packages.
pkg update && pkg upgrade -yInstall OpenSSL.
pkg install openssl openssl-tool -yCheck the installed version.
openssl versionOpenSSL is now installed and ready to use.
Use OpenSSL in Termux
After installing OpenSSL, you can use different commands for hashing, encryption, certificates, random data, and secure connections.
Show the help menu.
openssl helpGenerate random data.
openssl rand -hex 16Generate a SHA-256 hash.
echo -n "Hello World" | openssl dgst -sha256Generate a SHA-512 hash.
echo -n "Hello World" | openssl dgst -sha512Calculate the SHA-256 hash of a file.
openssl dgst -sha256 filename.txtEncode text with Base64.
echo -n "Hello World" | openssl base64Decode Base64 text.
echo "SGVsbG8gV29ybGQ=" | openssl base64 -dEncrypt a File
Create a test file.
echo "This is my secret file." > secret.txtEncrypt the file with AES-256.
openssl enc -aes-256-cbc -salt -in secret.txt -out secret.txt.encEnter a password when OpenSSL asks for one. The encrypted file will be saved as secret.txt.enc.
Decrypt a File
Use the following command to decrypt the encrypted file.
openssl enc -d -aes-256-cbc -in secret.txt.enc -out decrypted.txtEnter the same password that you used during encryption.
View the decrypted file.
cat decrypted.txtGenerate a 2048-bit RSA private key.
openssl genrsa -out private.key 2048Generate a public key from the private key.
openssl rsa -in private.key -pubout -out public.keyCreate a self-signed certificate.
openssl req -new -x509 -key private.key -out certificate.crt -days 365View certificate information.
openssl x509 -in certificate.crt -text -nooutCheck an HTTPS connection.
openssl s_client -connect example.com:443You can use these commands to learn how OpenSSL works with files, hashes, encryption, keys, certificates, and secure connections in Termux.
End Note
OpenSSL is a useful tool for learning encryption and security in Termux. You can use simple commands to protect files, create hashes, generate keys, and check secure connections from your terminal.

