AES, A Stronger Cipher Than XOR

The Problem In a previous post, Encrypting and Decrypting Text, I discussed how the shared key derived from a Diffie-Hellman Key Exchange can be used with a simple cipher (XOR) to encrypt and decrypt text. I wrote a demonstration program that sends encrypted messages between a client and server, with the server knowing how to respond to funny lines from the classic comedy, Airplane! I concluded with a mysterious statement, “There’s a weakness in our simple XOR cipher that’s exposed by sending a message not recognized as a line from Airplane!” Let’s pick up there by sending a simple phrase […]

Encrypting and Decrypting Text

In a previous post, The Math That Enables Asymmetric Key Cryptography, I discussed how your web browser and a web server can establish an encrypted communication channel without requiring you and the web administrator to meet beforehand to exchange secret keys. I explained how your web browser and a web server exchange public keys, then perform math operations on their private keys and the exchanged public keys to derive the same shared key. And I emphasized the security of this technique (Diffie-Hellman Key Exchange) is guaranteed by the computational difficulty of determining the shared key from the partial information transmitted […]

Iterating over a Generic Dictionary

It can be tedious to iterate over a generic Dictionary in C#, especially if the Dictionary contains complex types. The values you’re interested in are properties of the iteration variable. I never know what to name the iteration variable (here I name it “pair”), which is an indicator this code is clumsy. Make it easier on yourself by using C#’s Tuple Deconstruction language feature. First, write an extension method for the generic KeyValuePair class. Or, instead of writing the extension method, you can add a reference to my ErikTheCoder.ServiceContract package and add a using ErikTheCoder.ServiceContract; statement. Then rewrite your foreach […]

Modifying This Blog’s WordPress Theme

I decided to host my blog using WordPress for a few reasons. Mainly because it’s mature (read “debugged”) and feature-rich. However, the most important reason may be because it’s written in PHP and I hate PHP. It’s such an unstructured, inconsistent mess. Because I hate PHP, I won’t be tempted to tinker with the code that runs my blog. I’ll focus more on the content I write for my blog, which is the entire point of blogging. That, and to focus on the thought process necessary to conceive of and produce interesting, clearly-written content. Most everything I want to customize […]

The Math That Enables Asymmetric Key Cryptography

The Problem Let’s examine how it’s possible for your web browser to establish an encrypted communication channel with your bank’s website. Obviously you don’t want a malicious party to intercept your personal information (such as your password, account number, social security number, etc) as it’s transmitted to and from your web browser and the bank’s web server. When you opened an account the bank did not provide you with a secret decoder ring. So how does your web browser know how to decrypt data transmitted by the bank’s web server? And how does the bank’s web server know how to […]