Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; use Tk; =head1 NAME =head1 VERSION 0.1 (alpha) =head1 SYNOPSIS CryptEdit provides a quick text edit environment which saves directly to an encrypted file, which removes the incredibly insecure step of saving the text to a file on disk and then encrypting from there. =head1 AUTHOR Michael Libby =head1 USAGE C<> The program is set to use GnuPG using a keyring in a default location (or with an options file readable from the default location. (I have also included a sample that will use a keyring located on a floppy disk on a Windows machine). You may need to alter the $PRIV_CMD to operate with your install of PGP or GnuPG. Enter a valid pathname/filename. Enter a recipient name. Type your text (or even use cut and paste to insert text from elsewhere), click the "Encrypt to File" button. Viola! =cut #user settings #$PRIV_CMD must have a trailing space! my $PRIV_CMD = "gpg "; #my $PRIV_CMD = "pgp "; #my $PRIV_CMD = "gpg --homedir A: "; #construct the application window my $mw = Tk::MainWindow->new(); #create action buttons my $button_bar = $mw->Frame()->pack( -expand => 1, -fill => 'x'); my $button_encrypt = $button_bar->Button( -text => 'Encrypt to File', -command => \&encrypt_to_file ); my $button_exit = $button_bar->Button( -text => 'Exit', -command => \&exit_app ); $button_encrypt->pack( -side => 'left' ); $button_exit->pack( -side => 'left' ); #create entry fields my $name_frame = $mw->Frame()-> pack( -expand => 1, -fill => 'x' ); my $name_label = $name_frame->Label( text => 'Filename:')-> pack( -side => 'left' ); my $name_entry = $name_frame->Entry()-> pack( -side => 'right', -fill => 'x', -expand => 1 ); my $recip_frame = $mw->Frame()-> pack( -expand => 1, -fill => 'x' ); my $recip_label = $recip_frame->Label( text => 'Recipient:')-> pack( -side => 'left' ); my $recip_entry = $recip_frame->Entry()-> pack( -side => 'right', -fill => 'x', -expand => 1 ); #create main text area my $text_box = $mw->Scrolled( 'Text', '-scrollbars' => 'e', )-> pack(); MainLoop; sub encrypt_to_file { #get privacy call command my $priv_call = $PRIV_CMD; $priv_call .= "-r " . $recip_entry->get() . " "; $priv_call .= "-o " . $name_entry->get() . " "; $priv_call .= "--encrypt "; #get text my $text = $text_box->get('1.0', 'end'); #open pipe to privacy command open( PRIVACY, "| $priv_call"); print PRIVACY $text; close PRIVACY; } sub exit_app { #add check if text changed since last saved or signed? exit; } =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also available in full at =cut

In reply to by ichimunki

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (4)
    As of 2018-06-18 00:28 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (107 votes). Check out past polls.