Digressing from the past couple of posts - I just wrote this little utility for myself that will do file encryption/decryption from the command line. I figured that some of you might also find this useful so I am sharing it out here.
File Encryption/Decryption utility v0.1
(c) Roshan James, Dec 1st 2004 Enc v0.1 uses 256 bit Rijndael encryption to give a relatively strong
encryption for data. The utility is built over the .Net 2.0 Crypto API.
Syntax:
enc +< password> < filename>
to encrypt a file
enc -< password> < filename>
to decrypt a file
enc ?< password> < filename>
to view fileinfo
This is no rocket science – simple usage of the API - but gives you reasonably good locking and a handy tool. The 256 bit Rijndael encryption implies that you can provide a password that is upto 16 chars in length. The encryption algorithm is a symmetric one – which means that you use the same password to decrypt the file.
This is also very rudimentary – no error checks and blah done: just enough code to get the job done.
Usage:
This is how you encrypt a file
> enc +password foobar.txt
Creating:2004-12-01--1206711.enc (foobar.txt)
It creates a new file called ‘2004-12-01--1206711.enc’ using the current date-time. This file is always a few bytes larger than the original. To extract the foobar.txt again you would say –
>enc -password 2004-12-01--1206711.enc
If you did not wish to extract the contents of an enc file, but you just what to see what file it contains, you say –
>enc ?password 2004-12-01--1206711.enc
2004-12-01--1206711.enc ==> foobar.txt
The exe here is a .Net 2.0 executable. The source is also there, so you can compile under your pet version of the runtime. To compile
> csc enc.cs
And of course, it can encrypt any kind of file.
Download
Let me know if you want some simple switches/features added.
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Roshan James
E-mail