* 12 *

Encryption

Self-test problems

  1. Explain the basic idea behind an encryption algorithm.
  2. Is it necessary to use a secret key? What is the alternative to using a secret key?
  3. Explain why no public security algorithm can increase security, it can only change the nature of the security problem.
  4. Which is more secure: a file which lies in a directory which you have no access to, or an encrypted file to which you do not have the key?

Graded problems

  1. This problem is about brute force attacks on simple encryption methods. Below is an ASCII character table in white, with a simple Caesar cipher in orange, showing a shift of a few characters. The orange table is calculated simply from the first using modulo (clock) arithmetic. Since the table starts from ASCII value 32 (space) and runs over 96 printable characters, the orange table is calculated as
    for (ascii = 32; ascii <= 127; ascii++)
       {
       encypted = 32 + (ascii-32+offset) % 96;
       }
    
    In this simple computation, the offset (=4) is the encryption key.

    ASCII Csar wheel
    32 36$48052464@68D80P84T96`100d112p116t
    33!37%49153565A69E81Q85U97a101e113q117u
    34"38&50254666B70F82R86V98b102f114r118v
    35#39'51355767C71G83S87W99c103g115s119w
    36$40(52456868D72H84T88X100d104h116t120x
    37%41)53557969E73I85U89Y101e105i117u121y
    38&42*54658:70F74J86V90Z102f106j118v122z
    39'43+55759;71G75K87W91[103g107k119w123{
    40(44,56860<72H76L88X92\104h108l120x124|
    41)45-57961=73I77M89Y93]105i109m121y125}
    42*46.58:62>74J78N90Z94^106j110n122z126~
    43+47/59;63?75K79O91[95_107k111o123{127
    44,48060<64@76L80P92\96`108l112p124|32
    45-49161=65A77M81Q93]97a109m113q125}33!
    46.50262>66B78N82R94^98b110n114r126~34"
    47/51363?67C79O83S95_99c111o115s12735#

    In olden times, encryption was accomplished using a wheel marked with characters. Use the programming technique to decrypt the following messages, by trying every possible key until the correct key is found. How do you know when the correct key has been found?

    Message 1:
    
    Ymnx%rjxxflj%htzqi%mf{j%gjjs%stsxjsxj1%tw%fs~%qfslzflj3%Qzhp~%ktw%~tz1%fy%qjfxy%ny,x%wjfifgqj&&
    
    Message 2:
    
    deiflaksfllleff74r4wgfiurk3i4w&(/UFu6rIywo8yhdowd
    
    
    This search method is the most primitive way of decrypting a message. In this case, the problem is trivial. The aim of cryptography is to make this type of computation practically impossible.

  2. The purpose of this problem is to use 3DES encryption algorithms in an actual program. You will need to use the SecurityKit to do this problem.

    What you should see from this problem is just how fragile data transmission is when the data are encrypted. If a single byte is lost or altered, it can become impossible to recover the data.

  3. In the security course kit, copy the file below to replace the appl.cpp. This file generates MD5 checksums. Compile the program and test it, by typing in different strings. Notice how two strings must be identical in order to give the same message digest.
    /*****************************************************************************/
    /*                                                                           */
    /* File: appl.cpp                                                            */
    /*                                                                           */
    /*****************************************************************************/
    
    #include "appl.h"
    #include "globals.h"
    #include "prototypes.h"
    
    void MDPrint (unsigned char *digest);
    
    /*****************************************************************************/
    
    main ()
    
    { MD5_CTX context;
      char buffer[bufsize];
      unsigned char digest[16];
    
    printf("Enter string:");
    scanf("%[^\n]",buffer);
    
    MD5_Init (&context);
    MD5_Update (&context,buffer,bufsize);
    MD5_Final (digest, &context);
    MDPrint(digest);
    }
    
    /*****************************************************************************/
    
    void MDPrint (unsigned char digest[16])
    
    { unsigned int i;
      char buffer[36];
    
    for (i = 0; i < 16; i++)
       {
       sprintf((char *)(buffer+2*i),"%02x", digest[i]);
       }
    
    printf("Message digest = %s\n",buffer);
    }                 
    
    
  4. Finally, you should use the programs above to complete the following test. Everyone should complete this individually.
    Multiple choice test - (weight 1)

    • -What is the MD5 checksum of "This file is intact!!"


      032f7c84333dc4d656174a6745d6f54b
      c4772e1bc9fdeb0d196819bea21e6180
      9c01137a8078b0f876befe45f681c331

    • -In DES cipher block chaining encryption


      The previous value of the work vector determines the encryption of the next.
      All blocks are independent and the value of the workvector is irrelevant.
      The work vector is just a dummy parameter for historical reasons.

    Login name 1: Password:



Back