Encrypt Using PGP Command Line (2024)

HOW TO: Encrypt Using PGP Command Line

book

Article ID: 153178

calendar_today

Updated On:

Products

PGP Command Line PGP Encryption Suite PGP Key Management Server PGP Key Mgmt Client Access and CLI API PGP SDK Desktop Email Encryption Drive Encryption Encryption Management Server Endpoint Encryption File Share Encryption Gateway Email Encryption

Issue/Introduction

PGP software allows the encryption of files and folders. In most cases, PGP Encryption Desktop will allow you to encrypt individual files and folders on an as-needed basis.

If you need to automate encryption into your scripting, or your automated application, PGP Command Line is an appropriate solution. This article describes how to use PGP Command Line to encrypt files.


Important TIP: PGP Command Line integrates with a secure PGP Encryption Server to store and manager keys centrally on the PGP server. This allows for seamless encryption without the need to store keys locally, which is better for convenience if you have multiple installations of PGP Command Line (Shared central location for keys), but also provides better security, because PGP Keypairs are not available on the servers where PGP Command Line is installed. Starting with PGP Command Line 11, the PGP Encryption Server is now included with PGP Command Line for this integration.

For information on how to encrypt with PGP Command Line using Symantec Encryption Management Server (AKA KMS) as well as a spreadsheet with all the useful PGP Command Line commands, see the following article:

159237 - Using PGP Command Line with Symantec Encryption Management Server (PGP Server)

Resolution


The file you intend to encrypt may be located in the current directory you have changed to in the command prompt, or you may specify the directory together with the file you want to encrypt. The file to be encrypted will be referred to in this document as (input). You will also need to specify a recipient, which will be referred to in this document as (user). Additional modifications can be used when encrypting a file, and these will be referred to as (options) in this document.

Note: PGP Command Line, by default, does not encrypt to the default key. If you want to encrypt to yourself, you will need to specify your key as a recipient.

Encrypt the File

1. Open a command prompt.

2. From the command prompt, enter:

pgp --encrypt (input) --recipient (user)

3. Press Enter.

PGP Command Line will respond as follows: 0x12345678:encrypt(input).txt:encrypt {output file (input).pgp} Please review the following examples: Example 1 The following example will show you how to encrypt a file to a specified user.

1. From the command prompt, type:

pgp --encrypt "Joe's file.txt" --recipient "PGP Joe"

2. Press Enter.

Example 2 The following example will show you how to encrypt a file located in a different directory, to a specified user.

1. From the command prompt, type:

pgp --encrypt "C:\Documents and Settings\PGP_Joe\Desktop\Joe's file.txt" --recipient "PGP Joe"

2. Press Enter.

Example 3 The following example will show you how to encrypt a file to a specified user, changing the name of the encrypted file using the (options) feature.

1. From the command prompt, type:

pgp --encrypt "Joe's file.txt" --recipient "PGP Joe" --output "Joe's test file.txt"

2. Press Enter.

Encryption Options

There are several options available for encrypting. These options are:

  • --output Lets you specify a different filename for the encrypted file.
  • --sign Lets you sign the encrypted file.
  • --armor Armors the output file. File extension is changed to .asc.
  • --comment Lets you specify a comment for armored data.
  • --text Forces the (input) to canonical text mode. Do not use this option with binary files. Automatic detection of file type is not supported.
  • --compress (--compression-algorithm is not valid).
  • --eyes-only Prevents the decrypted output from being saved to disk;the decrypted output can only be displayed on-screen.
  • --encrypt-to-self Lets you encrypt to the default key.
  • --archive Lets you combine multiple files into a single .pgp file.
  • --overwrite Lets you specify what to do if a file of the same name as the output filename already exists in the current directory.
  • --input-cleanup Lets you specify what to do with (input) files when the operation is done. The default is off (leave them alone).
  • --temp-cleanup Lets you specify how to handle temporary files. The default is to wipe them.
  • --verbose (-v) Shows verbose results information.
  • --debug (-d) Shows debugging information.

Encryption Options Examples

The following are examples of how to use the options above:

  • pgp --encrypt file.txt --recipient miller

    Encrypts a file, which will be called file.txt.pgp, to recipient "miller".

  • pgp -e file.txt -r miller

    Does the same as above, but using the short forms of the encrypt and the recipient commands.

  • pgp -er miller file.txt

    Combines multiple command short forms. "miller" must come after the "r" because it is a required argument to --recipient.

  • pgp -er miller file.txt --output encrypted-file.txt.pgp

    Redirects the output file to filename "encrypted-file.txt.pgp" without the quotes.

  • pgp -er (user) *.txt --output file1.pgp

    With archive mode (archive mode means you are using --archive as part of the command) enabled, all text files in the current directory are archived in a single file, "file1.pgp". If archive mode were disabled (you did not use --archive), this command would generate an error message.

  • pgp -er dir\test1.txt

    With archive mode enabled, directory information is retained. With archive mode disabled, directory information is lost; the decrypted file will go to .\test1.txt; the encrypted file will be dir\test1.txt.pgp.=

  • Encrypt to multiple recipients where keys are on the local keyring:

    pgp --encrypt report.txt README.rtf -r "Bill Brown" -r "Mary Smith" -r "Bob Smith"

    Use wildcards to specify the files to encrypt:
    pgp -er "Bob Smith" *.doc

    Encrypt multiple files into an archive:
    pgp -er "Bob Smith" *.doc --output archive.pgp --archive

    The following is important to know when using --encrypt:
    • Directories can be in the input list only if the archive option is enabled;otherwise, they are skipped. Directory information is preserved on decryption.
    • If the compress option is enabled, the preferred compression algorithm of the recipient is used. If there is more than one recipient, the most compatible algorithm is used.
    • You cannot specify a one time compression algorithm or a one time cipher algorithm with --encrypt.
    • When encrypting, the preferred cipher algorithm of the recipient is used. If there is more than one recipient, the most compatible algorithm is used.

For further guidance, reach out to Symantec Encryption Support.

Additional Information

178739 - HOW TO: Encrypt Files and Folders with PGP Encryption Desktop for Windows (Symantec Encryption Desktop)

180097 - HOW TO: Encrypt Files and Folders with PGP Encryption Desktop for macOS (Symantec Encryption Desktop)

153178 - HOW TO: Encrypt Using PGP Command Line

Feedback

thumb_up Yes

thumb_down No

Encrypt Using PGP Command Line (2024)

FAQs

How to encrypt a file using PGP command line? ›

Encrypt the File
  1. Open a command prompt.
  2. From the command prompt, enter: pgp --encrypt (input) --recipient (user)
  3. Press Enter.
Jun 13, 2024

How to encrypt a file using cmd? ›

To encrypt data from CMD, access Command Prompt, steer to the desired directory, and use the 'cipher /e' command. Common encryption issues include error messages and failed encryption. Troubleshoot these issues by understanding the error message and verifying file permissions and disk space.

How do I encrypt with PGP? ›

How do I encrypt using PGP?
  1. Install the PGP tool.
  2. The message receiver creates a public and private key.
  3. The receiver sends the public key to the user who will send the encrypted message.
  4. The sending user encrypts the message using the public key and sends it.
  5. The receiver decrypts the message with the private key.
May 8, 2023

What is the command line key for PGP? ›

For command-line PGP, the command is pgp -kxa. PGP will prompt you for your userID and a file to save your key in. Or you can enter pgp -kxa userID filename. The “-a” option means ASCII output.

How do I encrypt a PGP zip file? ›

Encrypt a file using conventional encryption
  1. Right click the file to be encrypted.
  2. Point to PGP Zip, and then click Encrypt or Encrypt & Sign. ...
  3. Check the box for Conventional Encryption.
Aug 1, 2024

How to encrypt text gpg command line? ›

Encryption/decryption commands
  1. To encrypt a plaintext file with the recipient's public key: gpg -e -r recipient_userid textfile.
  2. To sign a plaintext file with your secret key: gpg -s textfile.
Jul 12, 2023

How to start encryption in cmd? ›

  1. Open Command Prompt as Administrator:
  2. Identify the Drive Letter:
  3. Enable BitLocker with a Password:
  4. Create a Recovery Key:
  5. Start the Encryption Process:
  6. Check BitLocker Status:
Apr 7, 2022

How to encrypt password using cmd? ›

How do I Encrypt a Password?
  1. Find the folder where encrypt. ...
  2. Go to a command prompt. ...
  3. Use CD to change to that folder. ...
  4. Type “java -jar encrypt. ...
  5. Right click the command prompt and select Mark.
  6. Drag/select the encrypted password with the left mouse key.
Oct 9, 2017

How do I manually encrypt a file? ›

How to encrypt a file
  1. Right-click (or press and hold) a file or folder and select Properties.
  2. Select the Advanced button and select the Encrypt contents to secure data check box.
  3. Select OK to close the Advanced Attributes window, select Apply, and then select OK.

What is the secret key in PGP encryption? ›

PGP then creates a session key, which is a one-time-only secret key. This key is a random number generated from the random movements of your mouse and the keystrokes you type. This session key works with a very secure, fast conventional encryption algorithm to encrypt the plaintext; the result is ciphertext.

How to send a message using PGP? ›

The first step is to share your public key with the recipient.
  1. Open the Compose Window.
  2. From the Enigmail menu, select Attach Public Key..., then in the next panel, select the key you wish to attach to the message.
  3. Send the message with your key, but also remember to ask the recipient for their public key.
Jan 14, 2021

Is PGP good for file encryption? ›

PGP is generally considered more secure than symmetric encryption. Even if the channel transmitting the files becomes compromised, the private keys and files remain safe. Similarly, they are safe if the channel used to share public keys is compromised.

How do I use PGP key in Windows? ›

Basic steps for using PGP
  1. Install PGP on your computer.
  2. Create a private and public key pair. Before you can begin using PGP, you need to generate a key pair. ...
  3. Exchange public keys with others. ...
  4. Validate public keys. ...
  5. Encrypt and sign your email and files. ...
  6. Decrypt and verify your email and files. ...
  7. Wipe files.

How to install PGP command line? ›

To install PGP Command Line onto a Windows system:
  1. Close all Windows applications.
  2. Download the zip file PGPCommandLine*. ...
  3. Unzip the file and the *. ...
  4. Open a command prompt as a local administrator.
  5. Install using msiexec. ...
  6. Follow the on-screen instructions.
  7. If prompted, restart your machine.
Mar 15, 2024

How to generate a PGP encryption key? ›

Generate A Key Pair
  1. Open a command shell or DOS prompt.
  2. On the command line, enter: pgp --gen-key [user ID] --key-type [key type] --bits [bits #] --passphrase [passphrase] ...
  3. Press "Enter" when the command is complete. ...
  4. PGP Command line will now generate your keypair. ...
  5. To display your new keypair enter the following command:
Jan 31, 2024

How do I decrypt a file using PGP tool? ›

Average PGP software
  1. Open other PGP software.
  2. Trigger decryption action.
  3. Browse for input file.
  4. Browse for output file.
  5. Enter the passphrase.
  6. Confirm decryption.
  7. Open file explorer and browse for target folder.
  8. Double click on un-encrypted file. Edit file using associated application. Close it.

How to check PGP version in cmd? ›

To view your version and license:
  1. From a command prompt, switch to the PGP Command Line directory.
  2. Type pgp --version.
  3. Press Enter. The version information for PGP Command Line is displayed. PGP Command Line 10.5.1. PGP Command Line 10.5.1 build 283. All rights reserved.
Dec 15, 2023

How to gpg encrypt a file in Windows? ›

To do this, you open the Windows Command Prompt (Go Start-->All Programs-->Accessories-->Command Prompt) and type in "gpg --gen-key" at the command line. Pick the encryption method and run through the other options. For personal encryption, the defaults are a safe bet.

How do I send an encrypted email using PGP? ›

Provide the email address of the PGP user in the To field. Compose the email and click Encrypt, Sign & Send on top of the compose window. Provide the passphrase to digitally sign the email using the private key associated with your email address. Click Ok.

Top Articles
Office of Information and Regulatory Affairs
Overview | Campaign Factory | Acquia Product Documentation
Somboun Asian Market
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Ffxiv Shelfeye Reaver
Craftsman M230 Lawn Mower Oil Change
Wisconsin Women's Volleyball Team Leaked Pictures
Cad Calls Meriden Ct
Wmu Course Offerings
Top Financial Advisors in the U.S.
Corpse Bride Soap2Day
Optum Medicare Support
Pbr Wisconsin Baseball
Espn Expert Picks Week 2
454 Cu In Liters
4156303136
Painting Jobs Craigslist
Kamzz Llc
EASYfelt Plafondeiland
At&T Outage Today 2022 Map
Jordan Poyer Wiki
kvoa.com | News 4 Tucson
Cornedbeefapproved
Aes Salt Lake City Showdown
Stockton (California) – Travel guide at Wikivoyage
Primerica Shareholder Account
Kelley Fliehler Wikipedia
Willys Pickup For Sale Craigslist
County Cricket Championship, day one - scores, radio commentary & live text
Otis Offender Michigan
Stolen Touches Neva Altaj Read Online Free
Www Craigslist Com Shreveport Louisiana
How to Watch the X Trilogy Starring Mia Goth in Chronological Order
Seymour Johnson AFB | MilitaryINSTALLATIONS
Junee Warehouse | Imamother
Tds Wifi Outage
Elgin Il Building Department
Hindilinks4U Bollywood Action Movies
Ticket To Paradise Showtimes Near Marshall 6 Theatre
Pokemon Reborn Locations
Craigslist Tulsa Ok Farm And Garden
Cranston Sewer Tax
412Doctors
Timothy Warren Cobb Obituary
Professors Helpers Abbreviation
Dontrell Nelson - 2016 - Football - University of Memphis Athletics
Copd Active Learning Template
Bonecrusher Upgrade Rs3
The 13 best home gym equipment and machines of 2023
Kidcheck Login
Guidance | GreenStar™ 3 2630 Display
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 6392

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.