OpenSSL: encrypt decrypt file: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs) Created page with "sumber: http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/ Linux has plenty of powerful encryption software, but what can you use if you just wa..." |
Onnowpurbo (talk | contribs) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
==Encrypt File== | |||
Contoh perintahnya | |||
openssl aes-256-cbc -a -salt -in secrets.txt -out secrets.txt.enc | |||
Dimana, | |||
openssl aes-256-cbc -a -salt -in secrets.txt -out secrets.txt.enc | * openssl - perintah untuk OpenSSL tookit | ||
* aes-256-cbc - encryption cipher yang digunakan. 256bit AES digunakan oleh pemerintah US untuk encrypt informasi top secret level. | |||
* -a - encrypted output akan di encode base64, jadi bisa di lihat di text editor / copy paste di e-mail. | |||
* -salt - menambahkan kekuatan encryption & harus selalu digunakan. | |||
* -in secrets.txt - input file yang akan di encrypt. | |||
* -out secrets.txt.enc - output file hasil encrypt. | |||
Anda akan ditanya password untuk encrypt. | |||
==Decrypt file== | |||
openssl aes-256-cbc -d -a -in secrets.txt.enc -out secrets.txt.new | |||
Dimana, | |||
* -d - decrypt data. | |||
* -a - encrypted data adalah base64. | |||
* -in secrets.txt.enc - input file / data yang akan di decrypt. | |||
* -out secrets.txt.new - output file / data hasil decrypt. | |||
==Cara lain== | |||
Jika kita mempunyai data yang di encrypt berikut (passwordnya = pass) | |||
U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A= | |||
Kita bisa juga menggunakan CLI berikut ini, | |||
echo U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A= | openssl aes-256-cbc -d -a | |||
atau yang lebih gampang, tambahkan -pass pass:pass (pass yang ketiga adalah passwordnya) | |||
echo U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A= | openssl aes-256-cbc -d -a -pass pass:pass | |||
==Referensi== | ==Referensi== | ||
* http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/ | * http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/ | ||
* https://stackoverflow.com/questions/16056135/how-to-use-openssl-to-encrypt-decrypt-files | |||
Latest revision as of 13:51, 7 June 2017
sumber: http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/
Encrypt File
Contoh perintahnya
openssl aes-256-cbc -a -salt -in secrets.txt -out secrets.txt.enc
Dimana,
- openssl - perintah untuk OpenSSL tookit
- aes-256-cbc - encryption cipher yang digunakan. 256bit AES digunakan oleh pemerintah US untuk encrypt informasi top secret level.
- -a - encrypted output akan di encode base64, jadi bisa di lihat di text editor / copy paste di e-mail.
- -salt - menambahkan kekuatan encryption & harus selalu digunakan.
- -in secrets.txt - input file yang akan di encrypt.
- -out secrets.txt.enc - output file hasil encrypt.
Anda akan ditanya password untuk encrypt.
Decrypt file
openssl aes-256-cbc -d -a -in secrets.txt.enc -out secrets.txt.new
Dimana,
- -d - decrypt data.
- -a - encrypted data adalah base64.
- -in secrets.txt.enc - input file / data yang akan di decrypt.
- -out secrets.txt.new - output file / data hasil decrypt.
Cara lain
Jika kita mempunyai data yang di encrypt berikut (passwordnya = pass)
U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A=
Kita bisa juga menggunakan CLI berikut ini,
echo U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A= | openssl aes-256-cbc -d -a
atau yang lebih gampang, tambahkan -pass pass:pass (pass yang ketiga adalah passwordnya)
echo U2FsdGVkX18YcWkbmhsN7M/MP1E+GLf4IqmNsa53T+A= | openssl aes-256-cbc -d -a -pass pass:pass