Then echo "You need to set all variables to run the script: -m enc for encryption or dec for decryption, -s The string to encrypt/decrypt, -p The password for the encryption/decryption" #Check if all parameters are set, if not show an error message and exit the script #Get the parameteres of the script and assign them Git clone you can create your own shell script with the following content: #!/usr/bin/env bash ![]() You can download this script also from the Github repository: -pbkdf2: Method to derive a key from the passwordĮncryption/Decryption shell script on Linux using Openssl.-salt: To add a salt to the encryption/decrpytion and make it more secure.-aes-256-cbc: The encryption/decryption algorhitm.-e|-d: -e for encryption, -d for decryption.-base64: The output/input is a base64 string.What you are doing here is to pipe a string to the Openssl command. Run this command and you will get your decrypted string: This is a sample string The encryption command for Openssl can be tested as follows: echo U2FsdGVkX197zphyvS6awkczRJrhl0i+uDbvAyde5TvCH7H+iavpguAx5BiY3B圆 | openssl enc -base64 -d -aes-256-cbc -salt -pass pass:SuperS3curePassw0rd! -pbkdf2 You will get a result similar to this: U2FsdGVkX197zphyvS6awkczRJrhl0i+uDbvAyde5TvCH7H+iavpguAx5BiY3B圆 ![]() The encrpytion command for Openssl can be tested as follows: echo "This is a sample string" | openssl enc -base64 -e -aes-256-cbc -salt -pass pass:SuperS3curePassw0rd! -pbkdf2 Please read through this blog post on how to do this: Encryption/Decryption commands The prerequisite is that you have Openssl installed. In this blog post I am going to show you how you can use Openssl to encrypt and decrypt a string on the command line in Linux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |