I cannot replicate, using two similar (but not identical) setups. First is my windows machine, second is a virtual linux machine; both used perl v5.20.3, but have wildly different gpg versions. Both worked just fine (though I learned that virtual machines do not like building entropy; it took forever to generate my dummy key or to sign the message).

use strict; use warnings; use Test::More tests => 1; use Crypt::OpenPGP; use Crypt::Rijndael; use Config; my $message = "Hello world!\n"; my %args = (Compat => 'GnuPG'); if($^O eq 'MSWin32') { @args{qw/PubRing SecRing/} = ( '.../gnupg/pubring.gpg', '.../gnupg/secring.gpg', ) } my $pgp = Crypt::OpenPGP->new (%args); my $sig = $pgp->sign ( Data => $message, Clearsign => 1, KeyID => $ENV{GPG_SECRET_KEY}, Passphrase => $ENV{GPG_PP} ); ok ($sig) or diag ($pgp->errstr); diag $sig; diag sprintf "%-20s => v%s (%s)", 'perl', $], $Config{myuname}; diag sprintf "%-20s => v%s", 'Crypt::OpenPGP', $Crypt::OpenPGP::VERSIO +N; diag sprintf "%-20s => v%s", 'Crypt::Rijndael', $Crypt::Rijndael::VERS +ION; diag qx/gpg --version/;

__WINDOWS__ 1..1 ok 1 # -----BEGIN PGP SIGNED MESSAGE----- # Hash: SHA256 # # Hello world! # -----BEGIN PGP SIGNATURE----- # Version: Crypt::OpenPGP 1.12 # ... # -----END PGP SIGNATURE----- # perl => v5.020003 (Win32 strawberry-perl 5.20.3.3 #1 + Sun Mar 6 19:06:29 2016 x64) # Crypt::OpenPGP => v1.12 # Crypt::Rijndael => v1.13 # gpg (GnuPG) 2.2.11

__VIRTUAL__LINUX__ 1..1 ok 1 # -----BEGIN PGP SIGNED MESSAGE----- # Hash: SHA256 # # Hello world! # -----BEGIN PGP SIGNATURE----- # Version: Crypt::OpenPGP 1.12 # ... # -----END PGP SIGNATURE----- # perl => v5.020003 (linux pryrtdebian 3.2.0-4-486 #1 +debian 3.2.81-1 i686 gnulinux ) # Crypt::OpenPGP => v1.12 # Crypt::Rijndael => v1.13 # gpg (GnuPG) 1.4.12

... So no, I don't know what's going wrong with yours... I don't know whether it will help to know it does work on similar-but-not-identical situations. My best bet would be some bug in the interface with your specific version of gpg... Oh, are you using 32b or 64b perl? And is the gpg 32b or 64b? Maybe data is trying to cross a bitness boundary?


update: oh, right, I think it's just Windows that has mixed bitness. I confirmed my linux virtual box was 32bit. And on Windows, it was 64bit perl as shown, with 32bit gpg.exe, so at least in that direction, it was okay to be mixed; I also tried with a 32bit v5.26.1 on windows, with the same results.


In reply to Re^3: GPG signing Issue by pryrt
in thread GPG signing Issue by roperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.