Those wiser than I,
I am attempting to encrypt using GPG.pm. I have searched and have been unable to find any posts with any more ideas. I wrote the following test script as my full CGI was complex and harder to isolate the problem:
#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); #show us the errors in the browser use GPG; #the GPG perl module my $gpg = new GPG( #create a new GPG object homedir => '/home/xxxxxx/.gnupg', #specify the directory gnupg_path => '/usr/bin', #non-standard path to gpg binary armor => '1', #make sure the output is ascii armored debug => '1' #debug mode to trouble shoot ); my $encrypted = $gpg->encrypt("Testing GPG", 'xxxx@xxxxx.com'); # This is where things break down. # GPG's debug looks fine but # I am unable to use the resulting scalar. print <<"_END_"; Content-type: text/plain Encrypted: -> $encrypted <- _END_
This is the output in both the browser and the command line. Notice that the scalar $encrypted is empty, however the gpg command seemed to work fine:
******************************************************************** COMMAND : /usr/bin/gpg -a --homedir /home/xxxxx/.gnupg --batch --no-co +mment --no-version $self->{'homedir'} : /home/xxxxx/.gnupg $self->{'config'} : $self->{'armor'} : 1 $self->{'debug'} : 1 ******************************************************************** ******************************************************************** COMMAND : /usr/bin/gpg -a --homedir /home/xxxxx/.gnupg --batch --no-comment --no +-version -r xxxxx@xxxxxxx.com --encrypt [PID 20804] STDIN : Testing GPG STDOUT : -----BEGIN PGP MESSAGE----- hQEOA48qWedehilLEAP+OY9G7xnv8QR5iXdg8zt6eccudlO+Qz8liAm7Zxd2JHZW oo6VKCa913HQuVJvV38c9F4HTIKorL7DaNyqQXI6poFUx4NqAk5slScug8hzbIn3 PucLXP9YBtGiRea5IpWCe1F3f7Rondaq3dnxkx210mtwT4W/i0h2b9BRNv+kwDwD /RHwL+kVtSAo98C/4TKAihPleiYdtwJ/xcJuV38j2t/V+SgCWE5R7QvwWF/oT395 w5ICu83ox1r6frOH/dnao9mkLrdpLONJfh/gRDRtx1ehLBPgyAxhJTwQDeFoxhTL OlDftD8p6fTn1ftJjKE9wcoOt02Del+YXRBpOXVHCZUJ0kYBb31wayNPdxGTx6No l4pjHB67pO2DTqQGg5vkauLqEwWUpFN+ILwLK7zjlmTY/onjkIBB5An4RG0eAnF/ 85/ImeXRtCWJ =dMrS -----END PGP MESSAGE----- WARNING : STDERR : gpg: WARNING: "--no-comment" is a deprecated option gpg: please use "--no-sk-comments" instead ******************************************************************** Content-type: text/plain Encrypted: -> <-
Thank you so much for your help :-)

In reply to Problems with GPG.pm by auser

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.