How to use: drag and drop files into the executable icon. You will be asked for a password. The program will then create encrypted files with the ".gpg" extension (it will not delete the original files for you).

If you drop files with the ".gpg" extension, the files will be un-encrypted back.

Installation: use "PAR" (or Perl2EXE/PerlApp) to make an executable file, and copy it to the pen drive. You will need to copy the "gpg" executable to the same directory.

I've tested it with perlapp, in Windows XP and NT.

#!/usr/bin/perl -w # Copyright (c) 2005 Flavio S. Glock. All rights reserved. # This program is free software; you can redistribute it # and/or modify it under the same terms as Perl itself. use strict; use Tk; { my $gpg = $0; $gpg =~ s/[a-z0-9.]+$/gpg.exe/i; exit unless @ARGV; my $main = MainWindow->new; $main->Label(-text => 'Passphrase')->pack; my $pass = $main->Entry(-width => 12, -show => '*'); $pass->pack; $main->Button(-text => 'Go', -command => sub { do_encrypt($pass, $gpg, @ARGV); $main->destroy; } )->pack; $main->Button(-text => 'Cancel', -command => [$main => 'destroy'] )->pack; MainLoop; } sub do_encrypt { my ($pass, $gpg, @files) = @_; my @cmd; for ( @files ) { if ( $_ =~ /(.*)\.gpg$/i ) { @cmd = ($gpg, '--decrypt', '--passphrase-fd 0', '-o', '"' . $1 . '"', '--batch', '--no-tty', '"' . $_ . '"', ); } else { @cmd = ($gpg, '--symmetric', '--passphrase-fd 0', '-o', '"' . $_ . '.gpg"', '--batch', '--no-tty', '"' . $_ . '"', ); } open( FILE, '|-', "@cmd" ); print FILE $pass->get, "\n"; close( FILE ); } }

In reply to Drag-and-drop encrypting files in a pen drive by fglock

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.