#!/usr/bin/perl # gpg.pl use Crypt::OpenPGP; use DBI; my $string = $ARGV[0]; my $dbh = DBI->connect("DBI:mysql:pgpdb:localhost","user","password"); my $insert_stmt = 'insert into pgptable (card) values (?)'; my $sth = $dbh->prepare($insert_stmt); my $pgp = Crypt::OpenPGP->new; my $ciphertext = $pgp->encrypt( Data => $string, Recipients => 'Test User', Armour => 1, ); $sth->execute($ciphertext) || die $dbh->stderr;