In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use age to encrypt and decrypt files in Linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Age is a simple, easy-to-use tool that allows you to encrypt and decrypt files with a password.
The protection of files and the secure encryption of sensitive documents are issues of concern to users for a long time. Even if more and more data is stored on websites and cloud services and protected by user accounts with increasingly secure and strong passwords, there is still great value in being able to store sensitive data in our file systems. especially if we can encrypt it quickly and easily.
Age can help you do this. It is a small and easy-to-use tool that allows you to encrypt a file with a password and decrypt it as needed.
Install age
Age can be installed from many Linux software libraries.
Install it on Fedora:
Sudo dnf install age-y
On macOS, use MacPorts or Homebrew to install. On Windows, use Chocolatey to install.
Encrypt and decrypt files with age
Age can encrypt and decrypt files with a public key or a user-defined password.
Using a public key in age first generates a public key and writes it to the key.txt file:
$age-keygen-o key.txtPublic key: age16frc22wz6z206hslrjzuv2tnsuw32rk80pnrku07fh7hrmxhudawase896m9 uses public key encryption
To encrypt a file with your public key:
$touch mypasswds.txt | age-r\ ageage16frc22wz6z206hslrjzuv2tnsuw32rk80pnrku07fh7hrmxhudawase896m9\ > mypass.tar.gz.age
In this example, I use the generated public key to encrypt the file mypasswds.txt, which is saved in an encrypted file named mypass.tar.gz.age.
Decrypt with public key
To decrypt encrypted files, use the age command and the-decrypt option:
$age-decrypt-I key.txt-o mypass.tar.gz mypass.tar.gz.age
In this example, age uses the key stored in key.text and decrypts the encrypted file I created in the previous step.
Encrypt with password
Encrypting files without using a public key is called symmetric encryption. It allows the user to set a password to encrypt and decrypt a file. To do this:
$age-passphrase-output mypasswd-encrypted.txt mypasswd.txtEnter passphrase (leave empty to autogenerate a secure one): Confirm passphrase:
In this example, age prompts you for a password that encrypts the input file mypasswd.txt and generates the encrypted file mypasswd-encrypted.txt.
Decrypt with password
To decrypt files encrypted with a password, you can use the age command and the-decrypt option:
$age-decrypt-output passwd-decrypt.txt mypasswd-encrypted.txt
In this example, age prompts you for a password, and age then decrypts the contents of the mypasswd-encrypted.txt encrypted file to passwd-decrypt.txt as long as the password you provided matches the password you set at the time of encryption.
Don't lose your key.
Whether you use password encryption or public key encryption, you cannot lose the credentials to encrypt the data. By design, files encrypted through age cannot be decrypted without a key for encryption. So please back up your public key and remember these passwords!
Easy encryption
Age is a really powerful tool. I like to encrypt my sensitive documents, especially tax records and other archival data, into .tz files for later access. Age is user-friendly, making it very easy to encrypt at any time.
This is the end of this article on "how to use age for file encryption and decryption in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.