By: Darrell Brogdon in Trends Tutorials on 2011年01月24日 [フレーム]
GnuPG is strictly a command-line utility. There are several GUI wrappers to GPG but the binary is usually required. Since its core purpose is to encrypt and decrypt information, we're first going to have a look at doing just that, using GPG.
As with most Unix-based command-line utilities you first call the gpg command followed by switches that affect the output of the utility. For example, to encrypt a file called "my_secret_data.txt" you would call GnuPG with the -ecommand to encrypt followed by the -r NAME to tell GnuPG who should be able to decrypt the file. "NAME" in this instance is the first name or email address of the person who will be receiving the encrypted file. (Note that the user indicated by NAME must be in your public key ring and can be obtained by typing gpg -list-keys).
Here it is in action:
$ gpg -e -r [email protected] my_secret_file.txt
Once this is done you will a file called 'my_secret_file.txt.gpg' in your current directory. Any attempts to view the contents of this file will prove futile unless you encrypted it using your own Public Key. Feeling like a secret agent yet?
Now suppose Mr. John Doe has encrypted a file and sent it to you. To decrypt it you simply use the -d switch followed by the encrypted file.
$ gpg -d john_doe_secret_file.txt.gpg
Since you have your private key contained within your secret key ring GnuPG can determine whom 'john_doe_secret_file.txt.gpg' was intended for and will decrypt it after you provide your passphrase.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in Trends )
What is Groovy? Getting Started with Groovy - A tutorial
Will C and C++ be replaced by newer languages?
Browser Based Communications - WebRTC
Introduction to Amazon Web Services
Using OBS Studio to record tutorial videos for YouTube
React vs Angular - How to choose?
Pros and Cons of 2FA / Two-Factor Authentication
Latest Articles (in Trends)
Using OBS Studio to record tutorial videos for YouTube
Will C and C++ be replaced by newer languages?
React vs Angular - How to choose?
What is Groovy? Getting Started with Groovy - A tutorial
Introduction to Amazon Web Services
Browser Based Communications - WebRTC
Will Apple open retail showrooms in India?
Using OBS Studio to record tutorial videos for YouTube
Will C and C++ be replaced by newer languages?
React vs Angular - How to choose?
What is Groovy? Getting Started with Groovy - A tutorial
Introduction to Amazon Web Services
Browser Based Communications - WebRTC
Will Apple open retail showrooms in India?
© 2023 Java-samples.com
Tutorial Archive: Data Science React Native Android AJAX ASP.net C C++ C# Cocoa Cloud Computing EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Trends WebServices XML Office 365 Hibernate
Latest Tutorials on: Data Science React Native Android AJAX ASP.net C Cocoa C++ C# EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Cloud Computing WebServices XML Office 365 Hibernate