automate gpg with perl

Discussion in 'Perl Misc' started by Kai Schlamp, Feb 24, 2004.

  1. Kai Schlamp

    Kai Schlamp Guest

    Hello ...

    I want to automate GnuPG via a Perl Script. (I am aware of the security
    risk).

    The problem is, when I execute the stated below script, i always get the
    output "Reading passphrase from file descriptor 3 ..." and gnupg waits
    for an input.
    If I just press return, I get an encrypted file, but if try to decrypt
    it with the password in the pass.txt, it fails.

    Here is my little test script:

    open(FILE, "./pass.txt") || die($!) ;
    $fd = fileno(FILE) ;
    system("c:/gnupg/gpg.exe --output test.gpg --passphrase-fd $fd
    --symmetric test.txt") ;
    close(FILE) || die($!) ;

    And another question:
    Is there a way to directly pass the password, perhaps in a perl pipe
    funktion or something like that? I mean only using perl functions,
    without the use of the shell pipe ("|").

    greets,
    Kai
     
    Kai Schlamp, Feb 24, 2004
    #1
    1. Advertising

  2. Kai Schlamp wrote:

    > Hello ...
    >
    > I want to automate GnuPG via a Perl Script. (I am aware of the security
    > risk).
    >
    > The problem is, when I execute the stated below script, i always get the
    > output "Reading passphrase from file descriptor 3 ..." and gnupg waits
    > for an input.
    > If I just press return, I get an encrypted file, but if try to decrypt
    > it with the password in the pass.txt, it fails.
    >
    > Here is my little test script:
    >
    > open(FILE, "./pass.txt") || die($!) ;
    > $fd = fileno(FILE) ;
    > system("c:/gnupg/gpg.exe --output test.gpg --passphrase-fd $fd
    > --symmetric test.txt") ;
    > close(FILE) || die($!) ;
    >
    > And another question:
    > Is there a way to directly pass the password, perhaps in a perl pipe
    > funktion or something like that? I mean only using perl functions,
    > without the use of the shell pipe ("|").
    >
    > greets,
    > Kai


    See my response in comp.security.pgp.discuss
     
    Matthew Braid, Feb 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will Hartung

    Java interacting with gpg

    Will Hartung, Feb 21, 2004, in forum: Java
    Replies:
    1
    Views:
    2,674
    Sudsy
    Feb 22, 2004
  2. Choo Zhi Min

    Cannot import Python 2.3.3 RPM GPG key

    Choo Zhi Min, May 11, 2004, in forum: Python
    Replies:
    1
    Views:
    519
    Paul Rubin
    May 11, 2004
  3. Alessandro Bottoni

    Decrypting GPG/PGP email messages

    Alessandro Bottoni, Sep 1, 2005, in forum: Python
    Replies:
    10
    Views:
    877
    Paul Rubin
    Sep 3, 2005
  4. Nomen Nescio

    Finding Return Code From GPG

    Nomen Nescio, Jul 4, 2006, in forum: Python
    Replies:
    5
    Views:
    1,075
    Nomen Nescio
    Jul 8, 2006
  5. akonsu
    Replies:
    1
    Views:
    394
    Piet van Oostrum
    Aug 14, 2009
Loading...

Share This Page