cmac has asked for the wisdom of the Perl Monks concerning the following question:

Several months back I thought it would be a good idea to be able to sign my handful of CPAN modules, so I tried to set up a PGP/gpg key. It did not go well, so I gave up on the idea.

Now downloading some signed CPAN modules doesn't work. Here is a sample log:
PJACKLAM/Math-BigInt-FastCalc-0.28.tar.gz /usr/bin/make -- OK CPAN: YAML loaded ok (v0.72) Running make test PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" " +test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/00sig.t ...... Warning: using insecure memory! gpg: failed to create temporary file `/home/s......./.gnupg/.#lk0x80dd +5e0.animalhead.com.10920': Permission denied gpg: keyblock resource `/home/s......./.gnupg/pubring.gpg': General er +ror gpg: Signature made Sat Feb 26 11:29:15 2011 PST using DSA key ID 4D5B +721A gpg: requesting key 4D5B721A from hkp server pool.sks-keyservers.net gpg: no writable keyring found: Unknown system error gpg: error reading `[stream]': General error gpg: Can't check signature: No public key ==> BAD/TAMPERED signature detected! <== t/00sig.t ...... 1/1 # Failed test 'Valid signature' # at t/00sig.t line 35. # got: -3 # expected: 0 # Looks like you failed 1 test of 1. t/00sig.t ...... Dubious, test returned 1 (wstat 256, 0x100)
Of course I'd like to fix PGP/gpg so it works, but failing that I'd like to delete whatever's getting in the way. Advice on how to do either of these things will be very welcome!

cmac

Replies are listed 'Best First'.
Re: bad gpg
by CountZero (Bishop) on Mar 22, 2011 at 09:41 UTC
    Actually it is difficult to say what exactly went wrong when you installed GPG, so perhaps a way forward is to uninstall the GPG applications and start over again?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: bad gpg
by thargas (Deacon) on Mar 22, 2011 at 12:33 UTC
    given the errors, I would guess that you don't have write access to the .gnupg directory. See if you can touch a file there as the user you were running the cpan install as.
      I can't.   .gnupg is root:me with 700 permissions, and all of the existing files in it are root:me with 600. But if I change permissions on .gnupg to 770, gpg squawks about lax permissions on the directory.
        If the .gnupg directory is owned and only writable by root, then you must run the cpan install as root, which you'd normally have to do anyway, in order to get things installed in the correct location. It sounds like you've got some non-standard setup. In which case I'm not likely to be able to help you. Sorry. :-(
Re: bad gpg
by flexvault (Monsignor) on Mar 22, 2011 at 16:05 UTC

    You may want to set up a global variable with all of your default gpg parameters.
    Examples:

    our $GPG = qq|/usr/local/bin/gpg --no-version --comment "" --no-secmem +-warning --no-permission-warning --homedir "./.gnupg" --no-tty|; # List keys my $cmd = qq|$GPG --fingerprint --list--keys --with-colons|; # Delete specific key my $cmd = qq|$GPG --delete-secret-and-public-keys 0x$Fingerprint|; # etc. etc. etc. # my $Result = qx|$cmd|; my @PGPKeys = split(/\n/,$Result); # Do something . . .

    Move or delete the 'homedir' directory, and then use only perl script(s) to work with the gpg entries. I don't know if this will work with windows, but it worked for me on all versions of *nix I tested. All permissions will be set up correctly.

    Hopefully, this will get you going.

    Good Luck

    "Well done is better than well said." - Benjamin Franklin

Re: bad gpg
by Anonymous Monk on Mar 22, 2011 at 07:27 UTC
    Advice on how to do either of these things will be very welcome!

    Get rid of the middleman (CPAN)