Cum criptam un fisier in Linux

Configurare noua (How To)

Situatie

Vrem sa trimitem cuiva un fisier insa vrem sa il trimitem criptat si cu parola.
Criptarea ne permite sa fim siguri ca acest fisier daca ajunge la alta persoana nu va putea fii citit.

Backup

nu este cazul

Solutie

Pasi de urmat

Intai voi crea un director

[root@testpup ~]# mkdir director_de_test
[root@testpup ~]# file director_de_test/
director_de_test/: directory

Apoi il voi cripta:
[root@testpup ~]# openssl aes-256-cbc -salt -in director_de_test/ -out director_de_test_criptat
enter aes-256-cbc encryption password:
Verifying – enter aes-256-cbc encryption password:
3078342380:error:0200B015:system library:fread:Is a directory:bss_file.c:245:
3078342380:error:20082002:BIO routines:FILE_READ:system lib:bss_file.c:246:
[root@testpup ~]# file director_de_test
[root@testpup ~]# file director_de_test_criptat
director_de_test_criptat: data

Se observa ca sistemul vede directorul director_de_test_criptat ca fiind de tip:data(cryptat)

Acelasi lucru putem sa il facem si pentru un fisier,de exemplu aici am folosit un fisier text.

[root@testpup ~]# touch fisier_de_cryptat
[root@testpup ~]# file fisier_de_cryptat
fisier_de_cryptat: empty
[root@testpup ~]# vim fisier_de_cryptat
[root@testpup ~]# file fisier_de_cryptat
fisier_de_cryptat: ASCII text
[root@testpup ~]# openssl aes-256-cbc -salt -in fisier_de_cryptat -out fisier_cryptat
enter aes-256-cbc encryption password:
Verifying – enter aes-256-cbc encryption password:
[root@testpup ~]# file fisier_
fisier_cryptat fisier_de_cryptat
[root@testpup ~]# file fisier_cryptat
fisier_cryptat: data
[root@testpup ~]# cat fisier_cryptat
Salted__▒▒ ▒▒▒▒▒▒qPeZ▒yl[▒▒▒S▒묚M▒▒#i?▒+fC▒[root@testpup ~]#

 

Aici se vede mult mai bine cum arata textul criptat(in fisierul txt original era introdus textul “Test de criptare”)

Tip solutie

Permanent

Voteaza

(0 out of 0 people found this article helpful)

Despre Autor

Leave A Comment?