Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

STDIO encrypt / decrypt example (perl)

Created: 08 Apr 2011
Andreas Zengel's picture

This script shows examples on how to use STDIO with PGP Command Line to encrypt/decrypt data without writen the data to a file.

Using STDIO: STDIN, STDOUT, STDERR allows to integrate PGP Command Line easily in existing applications and provides enhanced security since the plaintext does not need to be written to a drive before encryption / after decryption.

It shows how to use the PGP Command Line arguments "-i -" ("--input -") and "-o -" ("--output -")
 
PGP Command Line Version required (min): 9.0.0
PGP Universal Server Version required (min): (none, the script does not require PGP Universal Server
Script language: perl
Developed for platform: Windows
Platforms the script will work on: Windows, Linux, Unix etc (all platforms with a perl interpreter and PGP Command Line installed)
 
Notes:

  • The script is packaged in a zip file, also containing sample data and sample keys
  • The script executes some sample test cases to demonstrate how to use STDIO
  • The test cases executed by the script are
  • create keyrings  
  • import the recipient key  
  • import the senders key  
  • encrypt + sign file1 using stdio for output  
  • encrypt + sign file2 using stdio for input  
  • decrypt + verify file1 using stdio for input  
  • decrypt + verify file2 using stdio for output  

 

For further details on the perl piping options (open(COMMAND,"| $command")) see:

  • perlfunc: open  
  • perlfaq8: How can I capture STDERR from an external command?  
  • perl open tutorial: perlopentut  
  • perl IPC: perlipc 

Attachments: