Syntaxe Openssl pour chiffrer un fichier avec l’algorithme AES 256. On crée 2 scripts pour pouvoir chiffrer/déchiffrer rapidement en ligne de commande. A noter que, lors d’un chiffrement, Openssl crée un nouveau fichier et ne supprime pas le fichier d’origine. Il faudra veiller à le supprimer si nécessaire.
chiffrement du fichier $1
- Script chiffre.sh :
#!/bin/sh openssl enc -a -aes-256-cbc -in $1 -out $1.aes
- lien symbolique pour appeler le script de n’importe où
ln -s chiffre.sh /usr/local/bin/chiffre
- Pour chiffrer le fichier toto.txt :
chiffre toto.txt enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:
- Afficher les fichiers : on obtient un nouveau fichier .aes
ls toto.txt toto.txt.aes
déchiffrement du fichier $1
- Script dechiffre.sh
#!/bin/sh openssl enc -d -a -aes-256-cbc -in $1.aes -out $1
- Lien symbolique:
ln -s dechiffre.sh /usr/local/bin/dechiffre
- Pour déchiffrer le fichier toto.txt.aes :
dechiffre toto.txt enter aes-256-cbc decryption password:
On obtient à nouveau le fixhier toto.txt en clair.
AP:Associated Press4Antoine Griezmann will cost United up to 锟?00million from Atletico Madridrelated.
— RB Leipzig English (.RBLeipzig_EN) March 12, 2017Thankfully, there were no problems.