CIS 5357 - Network Security - Fall 2004

Homework assignment



Goal of Assignment: 

Implement a strong password authentication protocol called SRP (Secure Remote Password),
a proposed Internet Standard:    
Motivation:
Recipe for Success:

Recipe(s) for Failure:

Detailed Description of the assignment:

The purpose of this assignment is to implement a secure remote password protocol.  You are provided with Java implementations of the basic server and client functionality.  This server and client programs are extensible, i.e., their functionality is implemented through the use of protocol classes.  If you provide the client or server with different protocol class implementations, the behavior of the client and server will change.

The provided capability of the client/server is as such:
You must modify the behavior of the protocol such that:
In order to be fair to your work, each part will be graded independently, as follows: 
  1. If  authentication is implemented correctly:  60% of the grade.
  2. If encryption is implemented correctly:  30% of the grade
  3. Documentation: 10%


Specifications:

The SRP protocol has two phases:

1) Key agreement phase

2) Authentication phase, based on the common key agreed in (1).

The picture below describes the two messages that constitute the first phase.  Each server maintains a database of user entries, which are triples of:


Of these, the salt is generated at random when the server first establishes the user entry.  The verifier is provided by the user and is a one-way function of the username, the "raw" password,  and the salt.  (Since the raw password is never used directly for purposes of authentication, this protocol is secure against off-line dictionary attacks if the salt is unknown.)  The verifier is computed (by Alice) as follows:
One of the reasons why Java is used in this class (as opposed to C/C++) is that it has native support for arbitrary-precision arithmetic (i.e., arithmetic operations involving very large numbers).  Please refer to the class BigInteger.

When Alice needs to identify herself with Bob, she engages in the following protocol:


Alice and Bob exchange the key agreement messages in the SRP protocol.


The challenge values A and B are computed using specific algorithms:
This phase is completed with the generation of the common session key KAB from the shared values.  On her side, Alice computes:
while Bob computes:
Here the value u is an unsigned, 32-bit value obtaining from the first 4 bytes of the value SHA-1(B) -- using our previously described convention to convert between integers and byte arrays.

It is not hard to check that both values of S resulting from these different computations are equal.  Bob and Alice must use different ways to compute S because Alice knows the value 'a' and Bob the value 'b', but not conversely.  Only Alice or Bob may compute S as one needs to know at least one of these two values to execute either algorithm.  The result is that S is a shared, secret value.

From S, the common key is derived by computing a function called SHAInterleaves().  This function is essentially SHA-1 (which results in a 160-bit output), interleaved to obtain a 320-bit output:
After the common key is computed, Alice and Bob can authenticate each other:

Alice and Bob authenticate their common key exchanging messages

After this, they use the shared K to encrypt and authenticate messages back and forth.

In your implementation the messages will be encrypted with 112-bit triple-DES-ede in CBC mode, and authenticated with HmacSHA1 using a 128-bit key.
The steps are as follows:
  1. Initialize the cipher using DESede with PKCS5 padding. You can give it any size byte buffer to encrypt. The output will be of byte size a multiple of 8.
  2. Compute the HmacSHA1 using the hmac key. Attach to the end of your encryption.
  3. On the other end, yo can check the Hmac first, and if it succeeds, you can decrypt (after truncating the buffer to eliminate the trailing Hmac value.
In other words, you will use the bytes b[0] through b[23]  of the shared key K as a key K1 encryption, and bytes b[24] through b[40] of K as a key K2 for authentication.  You will use the encrypt-then-authenticate paradigm, i.e., you will first CBC-encrypt all messages, then process the encrypted message through the MAC to get an authentication tag that is attached to the end of the message.

To finalize the specification of the assignment, you need the description of the
SHAInterleaves() function.  It is as such:

Start with a byte array T = {T[0], T[1], T[2], ..., T[n]}.  First shrink T, if needed, by removing any zero bytes in the first positions.  In other words, T[0] should not equal the byte 0.  Then make sure that T does not have an odd number of bytes, by dropping an extra byte at the beginning.  Split T into two byte arrays alternating the indices.


   Both E and F should be exactly half the length of T.  Hash each one with regular SHA-1, i.e.

Then interleave the two hashes back together to form the output, i.e.

     result = G[0] | H[0] | G[1] | H[1] | ... | G[19] | H[19]

   The result will be 40 bytes (320 bits) long.


Final Observations:


Your client implementation will be tested against the server reference implementation, i.e., mine.   So IT IS ABSOLUTELY IMPORTANT THAT YOU IMPLEMENT YOUR EXTENSIONS according strictly to the specifications outlined here and in the remaining documentation.  EVEN IF your implementation is correct (in the sense that your client and server are compatible and implement the full functionality), if it is incompatible with the specification, it can only receive a maximum of 85% of the grade (if either client or server is non-compliant) or 75% (if both non-compliant). This compliance will be measure independently for encryption and authentication.