CSCI.4220 Network Programming
Fall, 2006
Class 21: Cryptography and Authentication

Most serious security breaches are not done by people breaking codes or otherwise using high tech methods to find security holes; they are done by low tech methods like looking over someone's shoulder as they type their password. In fact many security breaches are inside jobs in which people who have access to information steal or modify it.

Everything in this class is based on the assumption that passwords and keys are secure, and this is not a valid assumption.

Cryptography
There are two basic categories of cryptography systems

Here is a far from complete list of security related threats

Authentication functions

The purpose of authentication is to prevent masquerade. When Bob receives a message which is supposed to be from Alice, how does he know that it was really sent by Alice and not someone pretending to be Alice.

If Alice and Bob have agreed on a private symmetric key. known only to the two of them, and Bob uses this key to decrypt the message, and the message seems to be English, this is reasonably good evidence that the message came from Alice. However, if that is not good enough, Alice can attach a Message Authentication Code (MAC) or a hash function to the message.

A Message authentication code is a public function of the message and a secret key that produces a fixed length value that serves as the authenticator (aka a cryptographic checksum)

MAC = Ck(M)

where M is the message, k is the key, and MAC is the fixed length value. These have the feature that it is impossible to derive the message from the MAC. A widely used MAC is the Data Authentication Algorithm (DAA), based on DES.

Hash function a public function that maps a message of any length to a fixed length hash value that serves as the authenticator. It does not use a key, so anyone can compute it

One widely used hash function is MD5 (message digest algorithm) which produces a 128 bit value Another is the Secure Hash Algorithm SHA-1 and its variants.

Here is a method of addressing masquerading, message modification, and source repudiation. It uses public-private encryption, symmetric key encryption, and a hash function. Alice wants to send a message to Bob.

  1. Alice writes the message
  2. She appends a time and date stamp
  3. She calculates a hash function such as MD5 on this
  4. She encrypts this hash function with her private key
  5. She generates a random one time session key and uses this to encrypt the message using DES or a similar cipher.
  6. She encrypts the one time session key with Bob's public key
  7. She sends the message over the Internet.
The bad guy, Eve, can intercept the message, but she cannot read it. She can however, modify it, or resend it.
  1. Bob receives the message. He uses his private key to decrypt the one time session key
  2. He uses the one time session key to decrypt the message.
  3. He confirms the time and date. If Eve has delayed the message somehow, he will know this.
  4. He calculates the hash function.
  5. He uses Alice's public key to decrypt the hash value that Alice sent.
  6. He compare the two values. If they are the same, Bob knows that the message came from Alice and not someone pretending to be Alice, and that Eve did not modify the message in any way, because if she did, the two hash values would be different.
  7. If later, Alice denies sending the message or claims that the content was modified, Bob can show the original message and prove that it came from Alice at the specified time with the specified content.