Article View: alt.privacy.anon-server
Article #256226On-the-fly symmetric encryption
From: Rooster
Date: Sat, 21 Apr 2012 17:33
Date: Sat, 21 Apr 2012 17:33
148 lines
8076 bytes
8076 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I want to share an easy little technique in Windows that I just figured
out, which may save you a lot of time, depending on how often you use
symmetric encryption with gpg. It works whether or not you have a front-
end for gpg installed, but you don't have to use it on the command line.
It just takes a little bit of one time preparation but nothing difficult.
You only need Windows.
First, you will need to create this little one-liner batch script and save
it somewhere in your Windows directory:
paste|gpg -ac|clip
The best place to put it is the same directory where the Windows prompt takes you by default when you enter Start > Run and type cmd, and this is probably "c:\Documents and Settings\<username>", which is Windows equivalent of the Home in Linux. You need to save that little file as a batch file and give it any name you like, so long as the suffix extension is ".bat". So, it might be file1.bat, for example.
Now you are probably asking yourself a question like this, "How can I use
this batch file if I don't have those two commands already in Windows,
namely, 'paste' and 'clip'?" Well, that's a good question, and I have a
good answer. First, you probably do have 'clip' already, but you may not
know it. If you don't, that's okay too. You can check by going to a
command prompt and typing "clip /?". It will either give you some kind of
response about the version and maybe some examples, or it will tell you
that this command is not recognized.
If you have Windows XP, you may not have it yet, but later versions of
Windows do have it by default. In any case, you can make it easily enough,
and you can also make the other command too, that is, "paste". You do not
need any other program to make them because Windows itself is sufficient
to do so. All you need to do is to follow these simple and short
instructions here: http://huddledmasses.org/clipexe-and-the-missing-
pasteexe/.
Basically, to create these commands, you need to copy the little text
files, one at a time, provided on that site, and then put them into the
same Windows folder where your most recent ".Net" framework version is
stored in your directory. So, use whatever means you normally do to search
for the existing program file named "csc.exe" and then save these text
files in that same folder. You will need to name the one as a text file
called "paste.cs", and the other as "clip.cs". Now, using the Windows
command prompt, you go to the same folder where you saved the files and
you type this command at the prompt, without the quotes: "csc Paste.cs".
Here is the text that you would save in the file for "paste.cs":
- ------------- Paste.cs ---------------------
using System;
using System.Windows.Forms;
using System.Threading;
namespace Huddled {
public class Paste {
[STAThread]
static void Main( string[] args )
{
foreach(string line in Clipboard.GetText().Split(
new string[]{"\r\n","\n"},
StringSplitOptions.None ))
Console.WriteLine( line );
}
}
}
- ----------------------------------
And here is the text for the file "clip.cs":
- ------------- Clip.cs --------------------
using System;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace Huddled {
public class Clip {
[STAThread]
static void Main( string[] args )
{
string s;
StringBuilder output = new StringBuilder( string.Join(" ", args) );
while ((s = Console.ReadLine()) != null)
output.AppendLine(s);
Clipboard.SetText( output.ToString() );
}
}
}
- ---------------------------------
After you have run these two commands, separately:
csc Clip.cs
csc Paste.cs
You will find in that same directory that you now have these two command
files:
"clip.exe" and "paste.exe"
So, then you need to put these two files into your Windows directory so that they are available on your Path at the command prompt. Once you have done all that, and you have created the one-liner batch file as I stated above, you will be ready to go. After putting the batch file in your Home folder as I described above, you need to create a shortcut to it on the Windows Start > Programs menu. You should be able to do that much easily enough by right-clicking on Start > Explore > Programs, and after opening the Programs folder, you can right-click in it and use the Context menu for New > Shortcut, and that will take you to a Browse dialogue, where you now need to browse out to the batch file in your Home directory, where you should have saved it. Point to this batch file as the target program for your shortcut link and click Okay. Now go back to the Start menu on your desktop and find that shortcut, right-click on it and select Properties from the Context menu. In the dialogue box that opens, you will see a blank field called "Shortcut Key", in which you can type any letter you like. For example, if you type the letter S, you would see that Windows automatically inserts into this empty field this: Ctrl+Alt+S. You should save that and click OK.
Now you have a shortcut key to that batch file you created. If you type
Ctrl+Alt+S, the batch file will run automatically and open the cmd shell
window; and this batch script will now present you with a little window
prompting you to enter a password. Before you type the shortcut key, what
you should do is select some text, anywhere in any program in Windows, and
copy it to the Clipboard using whatever means you prefer, something like
Ctrl+C is always quick and easy. So, simply select some text that you
would like to symmetrically encrypt, use Ctrl+C to put it on the
Clipboard, type Ctrl+Alt+S (if the letter S is what you put for the
hotkey), and now enter a password. Then gpg will prompt you to repeat the
password a second time; after completing it a second time and typing OK,
the batch will end and the window will close, and the text that was on the
Clipboard will now be encrypted by gpg and placed back on the Clipboard,
ready for you to paste it back in to wherever you need it.
This technique will now be available for your use whenever you like, and
to use it you only need to type Ctrl+Alt+S. Happy messaging.
-----BEGIN PGP SIGNATURE-----
Version: N/A
iQGVAwUBT5Ltu+WcBAJ+953TAQIp7Av9FW5Rna9qpXPbHfUhnOwLPFORXNODWTJC
eSdnHViMLS+xnBs5vkrnoKN0z7MWU3cqEb8Tfoeq37obQdsfv2vM6s8p+ARptYD9
vg4zt9sNyn4ososRuO7ZuydS2cOdHh+W2MZ76U0xt+zzVoZCPY/Tc4+eEeAZ0lrn
84Fu5kwxe8Wevbxs4gOQrC8p5AtXwflZkumrdhkSqQc4g1qIF0aIttsIS/xLnTQO
AZVKV5aS2zJVn80eLqSiLNdHe82xJ+lDWY12330JQZ+XmLQjhRmw7gery6U5KIoW
XznGQOd8SzOYeV5PQFOMYMRY9blaGoO1al2Jm1bJdF56cP5cnjJl0N4E0mBKfuM0
BvufkmclpRNC77J/smXgl//aLIil/sMH8DGmW28hN6DWZm1S6RJOxXe19lA/Xy3w
B74aTKTcJ/iWuOmWSuN0mkRcuUsb8ezZ6KMPRiiWnryRDYsL6tLNwxHT6Zn0Zm06
7Y5uFzmB2BsuJBNxE+iG3Hf9hhOZH1wD
=cldy
-----END PGP SIGNATURE-----
--
"Only someone you trust can betray you"
rooster@thechickencoop.net
A happy member of Kingdom Animalia
Technical Details
Message-ID:
<CPPHZ2X741021.0650115741@reece.net.au>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <CPPHZ2X741021.0650115741@reece.net.au> Subject: On-the-fly symmetric encryption Date: Sat, 21 Apr 2012 17:33:37 +0000 From: Rooster <remailer@reece.net.au> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail X-Remailer-Contact: abuse@reece.net.au (English Only Please) Newsgroups: alt.privacy.anon-server Lines: 149 Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net X-Original-Bytes: 7799