Archive for November, 2007

VB.NET RC4 Encryption for database storage

November 28th, 2007

I recently had to upgrade some Classic ASP code to .NET for some data encryption.  The routines use RC4 encryption and make the result database friendly.  The following class can easily be dropped into your project for use with little effort.  The sample code shows the encryption and decryption methods.  You just provide the message and the key for either instance.  From there you can drop it in your database or do whatever you want!

Sample Usage:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim plainText As String = “I’m exposed!”
Dim passkey As String = “keep me safe”

Dim safeText As String
safeText = Encryption.Encrypt(plainText, passkey)

Response.Write(safeText)

Dim decrypted As String
decrypted = Encryption.Decrypt(safeText, passkey)

Response.Write(decrypted)

End Sub

You can view the entire class here.  If you’re looking for some quick and easy encryption this will do the trick.

CMD Email updated

November 27th, 2007

The email command line utility I wrote (and discussed here), CMD Email, has been updated.  The latest release supports email attachments.

You can download the latest runtime or source from the project page on CodePlex.