Posted on 2011-09-06 13:57:43.805513-07 by elsporko
Encryption fails for some keys, but not all
Hi there,

I am trying to create several encrypted files using different keys. The public keys were imported on the keyring using gpg and look fine to me. I run a process that throws data into a buffer which is then passed to Crypt-OpenPGP for encryption. For a couple of keys the encryption process seems to go into a loop and the encrypted file never gets created.

my $pgp = Crypt::OpenPGP->new(PubRing => $config->cfg('pubkeys')); # $buffer will become the data in the output file my $buffer; ## Fill $buffer here ## # Encrypt the data $pgp->encrypt( Data => $buffer, Armour => 1, Recipients => $key_id, );

Most of the time this produces an ASCII Armored file, but in a few small cases the process hangs during encryption.

All we require of our clients is that they send us a public key to be used to encrypt data specifically for them.
Direct Responses: 13494 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.