In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use openssl to encrypt and decrypt files, the article is very detailed, has a certain reference value, interested friends must read it!
Openssl is a secure socket layer password library, including the main cryptographic algorithms, common keys, certificate encapsulation management functions and the implementation of ssl protocol. The whole software package of OpenSSL can be divided into three main functional parts: SSL protocol library libssl, application command tool and cryptographic algorithm library libcrypto.
OpenSSL uses passwords to encrypt or decrypt files
\ 1. Encrypt a file using openssl (data.zip is the original file, back.zip is the encrypted file)
# openssl enc-e-aes256-in data.zip-out back.zip
Explanation: enc means to encrypt or decrypt a file symmetrically,-e means to encrypt a file,-aes256 means to encrypt a file using the aes256 algorithm,-in indicates a file that needs to be encrypted, and-out represents a new file generated after encryption. In the process of encryption, you will be required to enter an encryption password, which can be repeated twice to complete the encryption of the file.
\ 2. Decrypt a file using openssl (back.zip is encrypted file, data.zip is decrypted file)
# openssl enc-d-aes256-in back.zip-out data.zip
Explanation: enc means to encrypt or decrypt the file symmetrically,-d means to decrypt the file,-aes256 means to decrypt the file using the aes256 algorithm,-in indicates the file that needs to be decrypted, and-out indicates the new file generated after decryption. When decrypting a file, you will be required to enter the password set when the encrypted file can be decrypted.
* * OpenSSL uses keys to encrypt or decrypt files
**
\ 1. First, you need to use openssl to generate a 2048-bit key rsa.key file (rsa.key key file contains private and public keys)
# openssl genrsa-out rsa.key 2048
\ 2. Then extract the public key pub.key from the rsa.key key file
# openssl rsa-in rsa.key-pubout-out pub.key
\ 3. Encrypt a file using the pub.key public key (data.zip is the original file, back.zip is the encrypted file)
# openssl rsautl-encrypt-inkey pub.key-pubin-in data.zip-out back.zip
\ 4. Decrypt a file using the rsa.key private key (back.zip is the encrypted file, data.zip is the decrypted file)
# openssl rsautl-decrypt-inkey rsa.key-in back.zip-out data.zip
Finally, we use the OpenSSL tool to encrypt and store all the backed-up data files, which can ensure the protection of business system data and prevent leakage. We can also use other encryption tools such as GPG,VeraCrypt,trueCrypt to encrypt data, but it is more convenient to use OpenSSL because almost every Linux distribution comes with an OpenSSL package.
The above is all the contents of the article "how to encrypt and decrypt files using openssl". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.