Oddly enough, GPG asymmetric decryption doesn't need a username... it somehow knows which one to use. Here's some code ('Ton' is a public/private key that I had previously added to GPG's keyring. UPDATE: 'Ton' also does not have a passphrase.):
use GPGWrapper;
use strict;
my $data = "Hello World!\n";
my $user = "Ton";
print $data;
$data = GPG_Encrypt_Asym($user, $data);
print $data;
$data = GPG_Decrypt_Asym($data);
print "\n$data\n";
$data = GPG_Encrypt('dumb password', $data);
print $data;
$data = GPG_Decrypt('dumb password', $data);
print "\n$data\n";
The code assumes that you have the GPG executable in the system path. If it isn't, you'll have to put the path in the open2 statements. Hope this helps...
-Ton
-----
Be bloody, bold, and resolute; laugh to scorn
The power of man... |