Encrypt File: mudanças entre as edições

De Wiki Clusterlab.com.br
Ir para navegação Ir para pesquisar
(Criou página com 'Encrypt/decrypt file <syntaxhighlight lang=bash> $ date > date.file $ openssl aes-256-cbc -in date.file -out date.file.crypt enter AES-256-CBC encryption password: Verifying...')
 
Sem resumo de edição
Linha 1: Linha 1:
Encrypt/decrypt file
=Encrypt/decrypt file=
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
$ date > date.file
$ date > date.file
Linha 19: Linha 19:
$ cat date.file.decrypt
$ cat date.file.decrypt
ter 09 mai 2023 16:30:39 -03
ter 09 mai 2023 16:30:39 -03
</syntaxhighlight>
=Tar directory=
<syntaxhighlight lang=bash>
$ tar cf - ./somedir/ | gzip | openssl aes-256-cbc -in - -out - > somedir.tgz.crypt
$ cat somedir.tgz.crypt | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir
</syntaxhighlight>
=Tar directory high compression multi-thread=
<syntaxhighlight lang=bash>
$ export THREADS=$(lscpu | grep "^CPU(s):"| awk '{print $2} ')
$ tar cf - ./somedir/ | pigz -p $THREADS -9  | openssl aes-256-cbc -in - -out - > somedir.tgz.crypt
$ cat somedir.tgz.crypt | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir
</syntaxhighlight>
=Tar directory with high compression, multi-thread and splitting output in multiple files=
<syntaxhighlight lang=bash>
$ export THREADS=$(lscpu | grep "^CPU(s):"| awk '{print $2} ')
$ tar cf - ./somedir/ | pigz -p $THREADS -9  | openssl aes-256-cbc -in - -out - | split -b 256m - somedir.tgz.crypt.
$ cat somedir.tgz.crypt.* | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir
</syntaxhighlight>
</syntaxhighlight>

Edição das 19h44min de 9 de maio de 2023

Encrypt/decrypt file

$ date > date.file

$ openssl aes-256-cbc -in date.file -out date.file.crypt
enter AES-256-CBC encryption password:
Verifying - enter AES-256-CBC encryption password:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.

$ cat date.file.crypt
Salted__�)�w��mx�j��ar�j�$���ɭ(�T�e/i�u�^�

$ openssl aes-256-cbc -d -in date.file.crypt  -out date.file.decrypt
enter AES-256-CBC decryption password:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.

$ cat date.file.decrypt
ter 09 mai 2023 16:30:39 -03

Tar directory

$ tar cf - ./somedir/ | gzip | openssl aes-256-cbc -in - -out - > somedir.tgz.crypt
$ cat somedir.tgz.crypt | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir

Tar directory high compression multi-thread

$ export THREADS=$(lscpu | grep "^CPU(s):"| awk '{print $2} ')
$ tar cf - ./somedir/ | pigz -p $THREADS -9  | openssl aes-256-cbc -in - -out - > somedir.tgz.crypt
$ cat somedir.tgz.crypt | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir

Tar directory with high compression, multi-thread and splitting output in multiple files

$ export THREADS=$(lscpu | grep "^CPU(s):"| awk '{print $2} ')
$ tar cf - ./somedir/ | pigz -p $THREADS -9  | openssl aes-256-cbc -in - -out - | split -b 256m - somedir.tgz.crypt.
$ cat somedir.tgz.crypt.* | openssl aes-256-cbc -d -in - | tar xzvf - -C ./destdir