use strict;
use warnings;
require DBI;

$|=1;

my $dbh=DBI->connect('dbi:Pg:');
my $pub=`cat public.asc`;
my $pri=`cat private.asc`;


my $enc= $dbh->prepare("select armor(pgp_sym_encrypt_sign(?,?,dearmor(?),'debug=1'))");
my $dec= $dbh->prepare("select pgp_sym_decrypt_verify(dearmor(?),?,dearmor(?),'debug=1')");
my $i=1;


foreach my $ii (16300..16400) {
  #my $i=$ii;

  my $mes=scalar 'x'x$ii;
  $enc->execute($mes,"foobar$i",$pri);
  my ($message)=$enc->fetchrow();

  $dec->execute($message,"foobar$i",$pub);
  my ($message2)=$dec->fetchrow();
  die $ii unless $message2 eq $mes;
  warn "$ii\t".length($mes)."\t", time() if $ii%1000 ==0;
};
