Assignment 4 – Encryption Systems

Maximum Points = 50

The purpose of this lab is to focus on the study of classes, objects, GUI, and error checking through exception handling. This is also an opportunity to participate in a pair-programming experience.

 

 “Encryption is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key. The result of the process is encrypted information (in cryptography, referred to as ciphertext). In many contexts, the word encryption also implicitly refers to the reverse process, decryption (e.g. “software for encryption” can typically also perform decryption), to make the encrypted information readable again (i.e. to make it unencrypted).” [http://en.wikipedia.org/wiki/Encryption] Cryptography is the practice of hiding and retrieving information by enciphering and deciphering messages by means of transformations. Cryptanalysis is the process of converting ciphertext into plaintext without knowing the key used in encryption. Cryptology is the study of cryptography and cryptanalysis.

 

As a cryptographer, you have been asked by the National Signal Academy (NSA) to develop a program that includes a collection of encryption techniques. Your program will allow the user to select an encryption technique and encrypt and decrypt messages.

 

Encryption techniques have been around for thousands of years [http://csc.ColumbusState.edu/summers/Research/cipher-machines2.ppt]. One of the oldest and simplest techniques is the Caesar Cipher where each letter of the plaintext is shifted a fixed distance from the original position in the alphabet. For example, if the plaintext is “Java Rocks” and the shift distance is 5, then the ciphertext is “Ofaf Wthpx”. To decipher, you just shift by five in the other direction. You can simplify the work by using two disks similar to the ones shown in Fig. 1.

 

A variation of this was developed by Leon Battista Alberti where each letter is replaced by a predetermined letter using a cipher disk (Fig. 1). To decipher, you must have the complete list of pairings (or a cipher disk as shown) and the alignment of the letters.

 

Thomas Jefferson extends this idea to a cylinder with 24 sets of letters. To decipher would require having a cylinder and knowing which ring to use.

                      Fig. 2

 

Other types of early encryption include:

 

1)    The Mexican Army Cipher Disk (1913) with an outer ring of letters and four inner concentric rings of numbers.

 

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

1

2

3

4

5

6

7

8

9

10

11

12

13

14

14

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

 

 

 

 

The users agree before how to rotate the inner four rings and either which ring to use or whether to increment the ring if a letter is repeated. For example “Java Rocks” with 1, 27, 53, and 79 positioned under A, can be –

            10 01 22 01 18 14 03 11 19 or

            10 01 22 27 18 14 03 11 19, or

10 27 74 79 18 41 55 89 19, etc.

 

2)    The Confederate Cipher Disk, which was designed after the “Vigenčre system” which uses a key phrase and a disk with two concentric rings. Position each letter of the message under the letter ‘A’ in the outer ring. Find the letter in the key phrase in the respective position on the outer ring; the cipher letter is below in the inner ring. For example, if the plaintext is “Java Rocks” and the key phrase is “Computer Science”, then the cipher text is “Lohp Lhgbk” To decipher, you must know the key phrase and work backwards.

 

Your program will read (and display) the contents of a user-selected file [plaintext], apply an encryption algorithm to the clear text to create the ciphertext, and then display (and write) the ciphertext to a user-selected file. Your program should also be able to read (and display) the contents of a file containing the ciphertext and then decrypt contents back into plaintext. Your program will allow the user to select one of at least two different encryption algorithms. For additional challenges, add more encryption algorithms.

 

Your program should use a GUI with a title and a graphic. The GUI should display both the clear text and the cipher text, provide for a key if used by the cipher, buttons that determine whether the user wants to encrypt or decrypt the message, and a way to select the encryption algorithm to be used.

 

Plaintext files should all have extensions “txt” and ciphertext files should have extensions “cip”. Create an exception class that catches and handles the exception thrown when the user selects the wrong type file. Handle the exception by displaying an appropriate message and then continue processing.

 

You must also keep track of the hours you spent on this project and include it with both assignments:

 

Student name

Requirements Anaysis

Design

Implementation (coding)

Testing

 

 

 

 

 

 

 

 

 

 

 

Due before class on Thursday, March 26, 2009) Submit a .doc file containing the UML class diagram showing inheritance for all the classes used in your program and your timesheet. [10 pts]

(Due before class on Thursday, April 2, 2009) Submit your .java files containing your program to the dropbox in WebCT. [50 pts]

 Grades are determined using the following scale:

Grading Rubric  (Word document)