tar -c directory | openssl foo > encrypted_tarfile.dat
Мне нужен инструмент openssl для использования шифрования с открытым ключом.
Я нашел более ранний вопрос о симметричном шифровании в командной строке (sic!), Которого недостаточно. Я заглянул в справочную страницу openssl (1) и нашел только симметричное шифрование. Действительно ли openssl не поддерживает асимметричное шифрование?
В основном, многие пользователи должны создавать свои зашифрованные tar-файлы и хранить их в центральном месте, но только немногим разрешено их читать.
OpenSSL's asymmetric encryption routines lie under the rsautl subcommand. (In recent versions of OpenSSL, this has been superseded by the pkeyutl command, but the arguments seem to be the same.)
They can then decrypt the tar file using their private key:
openssl rsautl -decrypt -inkey Bob -in foo.tar.enc -out foo.tar
Do note that SSH and SSL use different key formats, so if you want to use an SSH key for the encryption/decryption, you can't just use ~/.ssh/id_rsa.pub as-is.
2
rems
Используйте gpg --encrypt .
С "-r" вы можете передать идентификатор пользователя.
Увидеть
man gpg
Похоже, DerMike спрашивает, как это сделать через openssl, правда?
Jeremy W. Sherman 10 лет назад
1
1
galets
Если вы не хотите устанавливать инфраструктуру gpg и просто хотите зашифровать файл с помощью пары открытого и закрытого ключей, вам может пригодиться следующий инструмент: https://github.com/galets/AsymmetricCrypt . Вам понадобится моно на Linux, чтобы запустить его.
Some confusion comes from the fact that s/mime and des3 are mentioned. But in fact the following happens in the examples above:
A fresh random symmetric key is generated
The file is encrypted using the symmetric key
The symmetric key is encrypted using an asymmetric algorithm with a public key stored in user.pem
The encrypted symmetric key, the encrypted file and metadata are put into a standard container
The end result is that in.txt file is encrypted into mail.msg file so only the user having the private key matching user.pem public key can decrypt it.