54
Algorithms and Software Tools Algorithms and Software Tools for Learning Mathematical for Learning Mathematical Fundamentals of Computer Fundamentals of Computer Security Security (with demonstration of (with demonstration of the Java Applets) the Java Applets) Vladimir V. Riabov, Ph.D. Professor of Computer Sciences & Mathematics Rivier College, Nashua, New Hampshire, USA E-mail: [email protected] Web: http://www.rivier.edu/faculty/vriabov /cs572aweb/ Central Connecticut State University March 6, 2012

Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Embed Size (px)

Citation preview

Page 1: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Algorithms and Software Tools for Algorithms and Software Tools for Learning Mathematical Learning Mathematical Fundamentals of Computer Security Fundamentals of Computer Security (with demonstration of the Java Applets)(with demonstration of the Java Applets)

Vladimir V. Riabov, Ph.D.Professor of Computer Sciences & MathematicsRivier College, Nashua, New Hampshire, USAE-mail: [email protected]: http://www.rivier.edu/faculty/vriabov/cs572aweb/

Central Connecticut State UniversityMarch 6, 2012

Page 2: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Mathematical Fundamentals of Mathematical Fundamentals of Computer Security: CHALLENGESComputer Security: CHALLENGES

Many computer security topics involve Math concepts that are not often taught, or inadequately covered, in curricula, including sets, permutations, combinations, and probability; number theory (divisibility, primes, groups, rings, and fields); modular arithmetic; and computability theory (the reasonableness of an algorithm).

The challenge is how to introduce these topics to a typically Math-phobic audience, without eliciting a “deer in the headlights” response.

We try to motivate coverage based on simple, real-world applications of these topics.

Vladimir Riabov 2Math Fundamentals of Computer Security

Page 3: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Non-Trivial Motivational Study Non-Trivial Motivational Study Cases: Cases: Puzzling vs. DrillingPuzzling vs. Drilling

Warm-Up Study Case: What is the last digit of the number 25975927

[mod(10)]?Using MSExcel™ spreadsheet, find the last digit

of the number 719 [mod(10)]?How to use your findings in these two cases for

encrypting e-messages?

Vladimir RiabovMath Fundamentals of Computer Security 3

“The whole art of teaching is only the art of awakening the natural curiosity of the young mind for the purpose of satisfying it afterwards,” – Anatole France

“The important thing is not to stop questioning... Never lose a holy curiosity,” – Albert Einstein

Page 4: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

What is the last digit of the numberWhat is the last digit of the number 2597259759275927 [[mod(10)mod(10)]]??

Vladimir RiabovMath Fundamentals of Computer Security 4

It’s enough to consider the last digit of a simpler number 75927;

Do your experiments! (see Table) “LAST” can be 7, 9, 3, or 1 only;

therefore, it is a cycle of four cases; The power, 5927 can be represented

as 5927 = 4*1481+3; Therefore, “LAST” of 75927 is the same

as the “LAST” of 73, which is “3”. Answer: “3”. Try MS Excel™Spreadsheets! (see

Table) Why the last digit of the number 7N at N

> 18 is 0 there? HINT: Consider the number of

“valuable” digits in large natural numbers calculated with MS Excel™!

N 7^N1 72 493 3434 24015 168076 1176497 8235438 57648019 40353607

10 28247524911 197732674312 1384128720113 9688901040714 67822307284915 474756150994316 3323293056960117 23263051398720718 162841359791045019 1139889518537310020 79792266297612000

Page 5: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Assignment-1: Cracking a Assignment-1: Cracking a Simple CipherSimple Cipher

The course textbook (Network Security: Private Communi-cation in a Public World by Charlie Kaufman, Radia Perlman, Mike Speciner, 2nd edition, 2004) contains two ciphers:

On the page immediately following the title page:Si spy net work, big fedjaw iog link kyxogy

On page 44:Cf lqr'xs xsnyctm n eqxxqgsy iqul qf

wdcp eqqh,erl lqrx qgt iqul!

These ciphers are simple substitution ciphers of the type that newspapers often publish daily as crypto-puzzles.

Vladimir RiabovMath Fundamentals of Computer Security 5

Page 6: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

What to Submit in Assignment-1 What to Submit in Assignment-1 Report?Report?

What plan of attack have you used? This may actually be more than one plan of attack, if one or more plans failed to produce results. I want to hear about all the unsuccessful attempts as well as the successful one(s) – this is often more illuminating than just discussing the successful approaches.  (You learn a lot more from your mistakes than from your successes!)

What assumptions you made; what deductions you made?

How long it took you to solve each of the puzzles.

HINT: Edgar Allan Poe's The Gold Bug and Sir Arthur Conan Doyle's The Adventure of the Dancing Men show examples of explanations of how their characters solved ciphers.

Vladimir RiabovMath Fundamentals of Computer Security 6

Page 7: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Examples of Student’s Assignment-1 Examples of Student’s Assignment-1 ReportsReports

Vladimir RiabovMath Fundamentals of Computer Security 7

Page 8: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Examples of Student’s Assignment-1 Examples of Student’s Assignment-1 ReportsReports

Vladimir RiabovMath Fundamentals of Computer Security 8

Page 9: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

LecturesLecturesHistory of cryptography; Sets, permutations, combinations, and probability; Number theory and modular arithmetic; Classical cryptosystems; Symmetric block ciphers; Public key cryptography; Message authentication codes;Hashes and message digests; Web security and privacy for users; Firewalls, tunneling and virtual private networks

(VPNs);Malware.

Vladimir RiabovMath Fundamentals of Computer Security 9

Page 10: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Java Applets Security Tools Java Applets Security Tools

Students have used these tools for reviewing topics on probabilities and combinatorics, as well as for deciphering simple Shift Substitution ciphertexts, MonoAlphabetic substitution ciphers, Playfair and Vigenère ciphers, as well as for exploring modular arithmetic and message digests.

Vladimir RiabovMath Fundamentals of Computer Security 10

Web: http://www.rivier.edu/faculty/vriabov/webresos.htm

Page 11: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Assignment-2: Cracking Classic Assignment-2: Cracking Classic CiphersCiphers

Here's the ciphertext for a message enciphered by using the Shift Substitution Cipher (known as Caesar's Cipher):

Qeb bkbjv mixkp ql xqqxzh lk Qrbpaxv jlokfkd

Vladimir RiabovMath Fundamentals of Computer Security 11

Q: Given the approach described above, for a Shift Substitution Cipher, how many possibilities are there for a shift value? Is this a feasible task?Ans: …

Page 12: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

MonoAlphabetic Substitution MonoAlphabetic Substitution CiphersCiphers MonoAlphabetic Substitution Ciphers employ another

approach:  Instead of using a simple shift to determine the letter mapping, they select an individual mapping for each character, where the relative position of the corresponding characters is, in general, different for all characters.

Q: How many possibilities are there for character mappings in this approach? Is this a feasible task?

Ans: …… Assumptions about the plaintext:

◦ That the plaintext consists of characters, not some kind of binary code.

◦ That it is written in some known natural language (e.g., English).

◦ That we know the frequency of letters in a typical piece of text in that language.

◦ That the plaintext is typical of normal English text, and so we expect the same frequencies of letters (approximately, within statistical fluctuations).

Vladimir RiabovMath Fundamentals of Computer Security 12

Page 13: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Student’s Report on Assignment-2: Student’s Report on Assignment-2: Cracking Classic CiphersCracking Classic Ciphers

Vladimir RiabovMath Fundamentals of Computer Security 13

Page 14: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

MonoAlphabetic Substitution MonoAlphabetic Substitution CiphersCiphers

Vladimir RiabovMath Fundamentals of Computer Security 14

Decrypt the cipher text-1 (3 pages, 620 words, 2,685 characters), where the original word spacing, punctuation, and style is retained.

Letter Frequencies Analysis

Page 15: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Student’s Report on Assignment-2: Student’s Report on Assignment-2: MonoAlphabetic Substitution CiphersMonoAlphabetic Substitution Ciphers

Vladimir RiabovMath Fundamentals of Computer Security 15

Page 16: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Polygram Substitution Polygram Substitution CiphersCiphersMapping single letters to single letters is not

secure, so cryptographers came up with the concept of mapping entire blocks of plaintext letters to blocks of ciphertext letters.◦ For example, using a block size of 8, we could

map blocks of 8 letters at a time: AAAAAAAA through ZZZZZZZZ -- there are 268 distinct possibilities.

◦ To break such a cipher, you would have to have a table of size 268 = 208,827,064,576 blocks, and also know the relative frequencies of the occurrence of 8-letter blocks in the plaintext.

Vladimir RiabovMath Fundamentals of Computer Security 16

Page 17: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring the Playfair CipherExploring the Playfair Cipher

Vladimir RiabovMath Fundamentals of Computer Security 17

In 1854, Sir Charles Wheatstone invented the Playfair Cipher, which is a polygram substitution cipher using a block size of 2. Based on the use of a 5 × 5 square matrix of letters, constructed starting from a keyword or keyphrase. Each unique letter from the phrase is inserted into the square, until there are no more letters, and then the remaining letters of the alphabet are added to fill the square. For example, the phrase "Cynicism is the last refuge of the romantic" produces the matrix shown below.

C Y N I/J S

M T H E L

A R F U G

O B D K P

Q V W X Z

Page 18: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring the Playfair Cipher Exploring the Playfair Cipher (continue)(continue)

Here are the rules to encipher a piece of plaintext:Massachusetts goes Republican!

◦ First, eliminate all non-letter characters, and upcase all letters:MASSACHUSETTSGOESREPUBLICAN

◦ Then, arrange the plaintext in pairs of letters. If any pair of letters contains the same letter (for example, 'SS'), then insert an 'X':MA SX SA CH US ET TS GO ES RE PU BL IC AN

◦ If there is a last character not paired, add an 'X'.

Vladimir RiabovMath Fundamentals of Computer Security 18

Page 19: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring the Playfair Cipher (continue)Exploring the Playfair Cipher (continue)

Vladimir RiabovMath Fundamentals of Computer Security 19

For each pair of plaintext characters, call the first p, and the second q; the corresponding ciphertext characters c and d:◦ If p and q are in the same row of the matrix, c is the letter to

the right of p, and d is the letter to the right of q, wrapping around if necessary

◦ If p and q are in the same column of the matrix, c is the letter below p, and d is the letter below q, wrapping around if necessary

◦ If p and q share neither the same row nor column, they define the corners of a square. The other two corners of the square are c and d, with c being the letter in the same column as p.

MA SX SA CH US ET TS GO ES RE PU BL IC AN

AO ZI GC MN IG LH YL PA IL TU GK TP SY CF

How would you decipher this message?

C Y N I/J S

M T H E L

A R F U G

O B D K P

Q V W X Z

Page 20: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Trying the Playfair Cipher Java Trying the Playfair Cipher Java AppletApplet

Vladimir RiabovMath Fundamentals of Computer Security 20

Page 21: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

PolyAlphabetic Substitution PolyAlphabetic Substitution CiphersCiphers

Because monoalphabetic substitution ciphers are so notoriously insecure, cryptographers invented PolyAlphabetic Substitution Ciphers

A PolyAlphabetic Substitution Cipher has:◦ A set of related monoalphabetic substitution rules,

and◦ A key to determine which particular rule is chosen

for a given transformation

Vladimir RiabovMath Fundamentals of Computer Security 21

Page 22: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

The Vigenère CipherThe Vigenère Cipher

The best known (and one of the simplest) polyalphabetic substitution cipher is the Vigenère CipherIt uses a Vigenère Tableau (table in French) or Vigenère Square

Vladimir RiabovMath Fundamentals of Computer Security 22

Page 23: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

The Vigenère CipherThe Vigenère CipherTo encrypt a plaintext

message:o Choose a key.o Extract the first letter in the

plaintext, p, and the first letter in the key, q.

o Use p to select a column in the tableau and q to select a row in the tableau. The character in the corresponding cell is the ciphertext character.

Vladimir RiabovMath Fundamentals of Computer Security 23

o Repeat for the second plaintext character, and second key letter, and so on. When you come to the end of the key, you wrap around to the first letter of the key.o The length of the key is called the period of the cipher.

Page 24: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

The Vigenère CipherThe Vigenère CipherThe strength of this cipher is that there are

multiple ciphertext letters for each plaintext letter, and so the letter frequency information is obscured.

For a long time, the Vigenère Cipher was considered unbreakable. ◦ Then a retired Prussian cavalry officer named Kasiski

noticed that repetitions occur in the ciphertext when characters of the key appear over the same characters in the ciphertext. The number of characters between the repetitions is a multiple of the period.

◦ The longer the period, the more secure is the cipher -- preferably the key value should be chosen to be as long as the plaintext, and should have no statistical relationship with it.

Vladimir RiabovMath Fundamentals of Computer Security 24

Page 25: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Variations of the Vigenère Variations of the Vigenère Cipher:Cipher:◦The Full Vigenère Cipher

Use of a tableau with each line representing a permutation of the alphabet, not just a simple shift

◦The Auto-Key Vigenère Cipher Both the key and [part of] the plaintext are the

used as the real key

◦The Running Key Vigenère Cipher (Vernam Cipher) Makes use of a very long key — for example, a

passage from a book, or a running loop of tape.

but each one of them is still vulnerable to a letter frequency analysis.

Vladimir RiabovMath Fundamentals of Computer Security 25

Page 26: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

The One-Time Pad CipherThe One-Time Pad CipherA U.S. Army Signal Officer, Joseph Mauborgne,

proposed an improvement on the Vernam Cipher -- the One-Time Pad. ◦ Uses a random key that is truly as long as the

message, with no repetitions.◦ This type of cipher is provably unbreakable.◦ It produces random output that bears no statistical

relationship to the plaintext, and so there is no way to break the cipher.

In practice, the one-time pad has problems:◦ No practical way of making large quantities of

random keys.◦ Key distribution is a truly daunting task.◦ For these reasons, the one-time pad is not used

today

Vladimir RiabovMath Fundamentals of Computer Security 26

Page 27: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring Probabilities: Exploring Probabilities: Simulating a Simulating a Coin TossCoin Toss

Vladimir RiabovMath Fundamentals of Computer Security 27

• 50%-50% chance the coin will land with heads facing up in a large number (N) of tosses;• Error is proportional to ~ 1/SQRT(N).

Page 28: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring Probabilities: Exploring Probabilities: Factorial, Power, Permutation, and Factorial, Power, Permutation, and Combination Utility of Java AppletsCombination Utility of Java Applets

Vladimir RiabovMath Fundamentals of Computer Security 28

Page 29: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring Prime Numbers: Exploring Prime Numbers: The Sieve of Eratosthenes Java AppletThe Sieve of Eratosthenes Java Applet

Vladimir RiabovMath Fundamentals of Computer Security 29

Page 30: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring Modular Arithmetic: Exploring Modular Arithmetic: Multiplicative InverseMultiplicative Inverse

Vladimir RiabovMath Fundamentals of Computer Security 30

a-1 ≡ x (mod p) has a solution iff a and p are relatively prime.

The only rows and columns in the Multiplication Table that contain a 1 are for values that are relatively prime to p = 10: 1, 3, 7, 9.

Page 31: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Modular Arithmetic: Finite, or Modular Arithmetic: Finite, or Galois FieldsGalois FieldsA finite field (also known as a Galois* Field) is a

field with a finite number of elements. Finite fields are critical to the success of many cryptographic algorithms.◦ The finite fields are completely known:

It can be shown that the order of a finite field (number of elements in the field) must be a power of a prime, pn, where n is a positive integer.

For a given prime, p, the finite field of order p, GF(p) is defined as the set Zp of integers {0, 1, ... , p - 1}, together with the arithmetic operations modulo p.

Vladimir RiabovMath Fundamentals of Computer Security 31

*Evariste Galois (1811-1832), French mathematician

Page 32: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Modular Arithmetic: Binary Modular Arithmetic: Binary SystemsSystemsHere are the values for (a + b) mod 2:

and (a•b) mod 2:

Vladimir RiabovMath Fundamentals of Computer Security 32

baba

baba

2mod)(

2mod)(

AND

XOR

Implementation:

The field Z2, ({0, 1}), is an important tool to analyze cryptographic algorithms by computer.

Page 33: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Modular Arithmetic:Modular Arithmetic:Cryptography uses modular arithmetic a

great deal, because:◦ Calculating discrete logarithms and square roots

mod n can be hard problems.◦ It's easier to work with on computers, because it

restricts the range of all intermediate values and results For a k-bit modulus, n, the intermediate results of any

addition, subtraction, or multiplication will not exceed 2k bits in length.

We can perform modular exponentiation without generating huge intermediate results

Arithmetic operations, mod 2, are natural for computers, because of the equivalence of addition with XOR, and multiplication with AND, etc.

Vladimir RiabovMath Fundamentals of Computer Security 33

Page 34: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Modular Arithmetic: Field Modular Arithmetic: Field ZZnn**Z is the set of all integersWe've seen that Zn is the set of

integers mod n◦Z10 = {0,1,2,3,4,5,6,7,8,9}

Zn* is defined as the set of mod n integers that are relatively prime to n◦Z10* = {1,3,7,9} (0 is missing because gcd(0,

10) = 10)

Vladimir RiabovMath Fundamentals of Computer Security 34

1 3 7 9 1 1 3 7 9 3 3 9 1 7 7 7 1 9 3 9 9 7 3 1

The multiplication table for Z10* indicates: Zn* is closed under multiplication mod n

Page 35: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Euler's Totient FunctionEuler's Totient FunctionAn important quantity in number theory

is Euler's Totient Function:◦ The number of positive integers less than n,

that are relatively prime to n. It is written φ(p):

φ(1) = 1φ(p) = p – 1 (for p prime)φ(m) < m – 1 (for m composite)

In other words, Euler's Totient Function φ(p) is the number of elements in Zn*

Vladimir RiabovMath Fundamentals of Computer Security 35

Page 36: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Properties of Euler's Totient Properties of Euler's Totient FunctionFunctionAssume we have two distinct prime numbers, p and

q, and an integer n = pq◦ Then: ◦ The set of residues in Zn is {0,1,...,(pq - 1)}

◦ The residues that are not relatively prime to n are: The set {p, 2p, ... ,(q - 1)p}, the set {q, 2q, ... ,(p - 1)q},

and 0

◦ So:

Vladimir RiabovMath Fundamentals of Computer Security 36

)1()1()(φ)(φ)(φ)(φ qpqppqn

)(φ)(φ

)1()1(

1)(

]1)1()1[()(φ

qp

qp

qppq

pqpqn

This fact laid the foundation to various modern encryption algorithms, including the RSA public key encryption (1977).

Page 37: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

RSA Algorithm (1977)RSA Algorithm (1977)

Vladimir RiabovMath Fundamentals of Computer Security 37

RSA Algorithm was created by Ron Rivest, Adi Shamir, and Len Adleman from MIT

Page 38: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

RSA ExampleRSA Example

Vladimir RiabovMath Fundamentals of Computer Security 38

Page 39: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Triple Data Encryption Triple Data Encryption AlgorithmAlgorithmOriginal Data Encryption Standard

(DES-1977) declared insecure in 1998Electronic Frontier Foundation & DES

Cracker machineNew DEA Standard (ANSI X9.17 1985)TDEA Algorithm (1999) uses 3 keys

and 3 executions of DEA algorithmEffective key length 168 bit.

Vladimir RiabovMath Fundamentals of Computer Security 39

Page 40: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Location of Encryption Location of Encryption DevicesDevices

Vladimir RiabovMath Fundamentals of Computer Security 40

Page 41: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Automatic Key Automatic Key DistributionDistribution

Vladimir RiabovMath Fundamentals of Computer Security 41

Traffic Padding: Produce cipher text continuously If no plain text to encode, send

random data Make traffic analysis impossible

Page 42: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

The Advanced Encryption Standard The Advanced Encryption Standard (AES)(AES) In 1997, the National Institute of Standards (NIST)

announced a contest to select a new encryption standard to be used for protecting sensitive, non-classified, U.S. government information.

Among 5 finalists, NIST chose a submission called "Rijndael" by two Belgian cryptographers – Joan Daemen and Vincent Rijmen. Rijndael uses arithmetic in the Galois Field GF(28), the finite field of order 256.

The order of a finite field (number of elements in the field) must be a power of a prime, pn, where n is a positive integer. In Rijndael n = 8, and each element of the field can be represented by an octet. The bits in the octet are the coefficients of a polynomial over Z2 modulo the irreducible Z2 polynomial.

Vladimir RiabovMath Fundamentals of Computer Security 42

Page 43: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Polynomial AlgebraPolynomial Algebra Operation of addition is performed using an XOR operation

denoted by . For example, all notations below are equivalent:

  (x6 + x4 + x2 + x + 1) + (x7 + x + 1) = x7 + x6 + x4 + x2 + 0[polynomial notation];

{01010111} {10000011} = {11010100} [binary notation].

Multiplication in Rijndael is the multiplication of polynomials modulo the irreducible polynomial. For example, in the polynomial notation:

(x6 + x4 + x2 + x + 1) • (x7 + x + 1)

= x13 + x11 + x9 + x8 + x6 + x5 + x4 + x3 + 1,

and

(x13 + x11 + x9 + x8 + x6 + x5 + x4 + x3 + 1) mod (x6 + x4 + x2 + x + 1) = x7 + x + 1.

Vladimir RiabovMath Fundamentals of Computer Security 43

The set of 256 possible byte values, with XOR used as addition, and the multiplication defined as above, has the structure of the finite field GF(28).

Page 44: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

One-Way Hash FunctionsOne-Way Hash FunctionsCan be viewed as a variation on a Message

Authentication Code (MAC) function:◦ A Hash Function accepts a variable-size message,

M, as input and produces a fixed-size output, referred to as a Hash Code, or Message Digest:

h = H(M)◦ Unlike a MAC function, a hash code:

does not use a key, and so is a function only of the input message

◦ A change to any bit (or bits) of the message results in a change to the hash code, which can provide an error-detection capability.

◦ A message digest can be used as a fingerprint for a message, to allow detection of message modification.

Vladimir RiabovMath Fundamentals of Computer Security 44

Page 45: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

One-Way Hash Functions One-Way Hash Functions (continue)(continue)Requirements for a hash function are:

◦ Can be applied to a block of data of any size◦ Produces a fixed-length output◦ H(M) is relatively easy to compute for any given

M, allowing for both software and hardware implementations

◦ For any given value h, it is computationally infeasible to find M such that h = H(M). This is the One-way Property.

◦ For any given block, M, it is computationally infeasible to find M' != M with H(M') = H(M). This is called Weak Collision Resistance.

◦ It is computationally infeasible to find any pair (M, M') such that H(M) = H(M'). This is called Strong Collision Resistance.

Vladimir RiabovMath Fundamentals of Computer Security 45

Page 46: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

One-Way Hash Functions One-Way Hash Functions (continue)(continue)The drive for hash/message digest

algorithms began with public key cryptography◦RSA Encryption Algorithm (1977) was

invented, but it was slow enough at that time to make it impractical when used alone.

◦A cryptographically secure message digest algorithm with high performance would make RSA Encryption Algorithm much more useful.

Vladimir RiabovMath Fundamentals of Computer Security 46

Page 47: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

One-Way Hash Function: One-Way Hash Function: Message Message Digest Digest ((MDMD))

After several attempts, Ron Rivest (of RSA fame) invented MD5 (defined in RFC 1321)◦ Produces a 128-bit one-way hash function

The NSA designed the Secure Hash Algorithm (SHA)

The National Institute of Standards and Technology (NIST), made it a standard.◦ They revised it very late in the game, because of

some (unspecified) weakness that had been found, and changed its name to SHA-1.

◦ SHA-1 is a 160-bit hash function based on MD4;◦ Shares much in common with MD5, but has a much

more conservative design;◦ 2 or 3 times slower than MD5.

Vladimir RiabovMath Fundamentals of Computer Security 47

Page 48: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Exploring Message Digests with Exploring Message Digests with Java AppletsJava Applets

Vladimir RiabovMath Fundamentals of Computer Security 48

Page 49: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Typical Usage of DigestsTypical Usage of DigestsHere's an example of the use of SHA-1 in a

real application – Java JAR files:◦ In the jce.jar (Java Cryptography Extension) JAR

file, the manifest contains the following:

Manifest-Version: 1.0Created-By: 1.4.1-internal (Sun Microsystems Inc.)

Name: javax/crypto/SealedObject.classSHA1-Digest: R+GWl6Zuqgtty1zOaP5RrRSGfQo=

Name: javax/crypto/KeyAgreementSpi.classSHA1-Digest: fdmlqpiTKMzV65+93O4tJ3Uo6wg=

Name: javax/crypto/spec/DESedeKeySpec.classSHA1-Digest: Q7UJvLuk8GST42GW6xDlXHe3Xv8=

Name: javax/crypto/spec/DHParameterSpec.classSHA1-Digest: y0oY9yd/BQQxEc/2q1Cytta/r2E=

Name: javax/crypto/interfaces/DHPrivateKey.classSHA1-Digest: jwgw7pakTyKOlLBNivsp6V6Ad4k=

Vladimir RiabovMath Fundamentals of Computer Security 49

Page 50: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Students' projects Students' projects implemented in local implemented in local companies and the community:companies and the community: Senthil Balakrishnan, “Wireless Encryption Technology” Tom Borick, “Secure Wi-Fi Technologies for Enterprise LAN

Network” Travis Bryant, “Steganography and Steganalysis” Soumya Busani, Anitha Karthikeyan, and Sunitha

Malipeddi, “Intrusion Prevention System” Praveen Dandu and Vineeta Sharma, “Security and SQL

Injections” Nigel D'Souza, Charles Heintzelman, and Suresh Kumar

Sundaravadivelu, “Virtual Private Networks” Harika Samudrala, “Firewalls Overview” Tejinder Singh, Arti Sood, and Daniel Szilagyi, “RADIUS

Protocol” Pratheeba Thangavel and Malathi Thiagarajan, “Secured

Communication in Java.”

Vladimir RiabovMath Fundamentals of Computer Security 50

Page 51: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Selected students' publications in Selected students' publications in Rivier Academic JournalRivier Academic Journal:: Snogles, D. Personal Encrypted Talk - Securing Instant

Messaging with a Java Application. (2005). Kumar, A. Development of Laboratory Exercises Based

on OPNET IT Guru Academic Version. (2005). Wekhande, V. Wi-Fi Technology: Security Issues.

(2006). Zupko, R. Introduction to the IEEE 802.16 Standard:

Wireless Broadband Access. (2007). Sood, A. Network Access Control. (2007). Grossman, J. Coding Theory: Introduction to Linear

Codes and Applications. (2008). Szilagyi, D., Sood, A., and Singh, T. RADIUS: A Remote

Authentication Dial-In User Service. (2009). Selent, D. Advanced Encryption Standard. (2010). (see http://www.rivier.edu/journal/).

Vladimir RiabovMath Fundamentals of Computer Security 51

Page 52: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

Conclusions & Conclusions & AcknowledgementAcknowledgement

The author has described some algorithms, tools, and experience of using the Java Applets in computer security courses for seniors and graduate students.

The experience has been in general a very positive one, while at the same time providing useful lessons learned.

The author believes that this algorithm-exploration and project-based approach with the Java Applets can be effectively applied to courses of a similar nature in academia, and the model can be extended to other areas of applied mathematics.

The presenter would like to acknowledge a contribution of Dr. Bryan Higgs, who taught the course on Computer Security at Rivier College in AYs 2005-2008.

Vladimir RiabovMath Fundamentals of Computer Security 52

Page 53: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

ReferencesReferences[1] Riabov, V. V. and Higgs, B. J. J. Comput. Small Coll., 2010; 25(6):

245-247.

[2] Kaufman, C., Perlman, R., and Speciner, M. Network Security: Private Communica-tion in a Public World, 2nd edition. Upper Saddle River, NJ: Prentice Hall, 2002.

[3] Grossman, J. Coding Theory: Introduction to Linear Codes and Applications. [Online] http://www.rivier.edu/journal/RCOAJ-Fall-2008_table.htm.

[4] Selent, D. Advanced Encryption Standard. Rivier Academic Journal, 2010, 6(2). [Online] http://www.rivier.edu/journal/archive/.

[5] Rivest, R., Shamir, A., and Adleman, L. Communications of the ACM, 1978; 21(2): 120-126.

[6] Riabov, V. V. J. Comput. Small Coll., 2006; 21(6): 88-99.

[7] Linton, T. Shift Substitution Cipher Tool: ShiftApplet.java. [Online] http://pages.central.edu/emp/LintonT/classes/spring01/cryptography/java/Shift.html.

[8] Bishop, D. Introduction to Cryptography with Java Applets. Sudbury, MA: Jones & Bartlett Learning, 2002.

Vladimir RiabovMath Fundamentals of Computer Security 53

Page 54: Algorithms and Software Tools for Learning Mathematical Fundamentals of Computer Security (with demonstration of the Java Applets) Vladimir V. Riabov,

References (continue)References (continue)[9] Frequencies. [Online]

http://www.simonsingh.net/The_Black_Chamber/frequencyanalysis.html

[10] Graham, R. L., Knuth D. E., and Patashnik, O. Concrete Mathematics. Reading, MA: Addison-Wesley, 1994.

[11] Ferguson, N., and Schneier, B. Practical Cryptography. Hoboken, NJ: Wiley, 2002.

[12] Federal Information Processing Standard (FIPS) for the Advanced Encryption Standard, FIPS-197. [Online] http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

[13] The MD5 Message-Digest Algorithm. Request For Comments, No. 1321. [Online] http://www.faqs.org/rfcs/rfc1321.html

[14] Secure Hash Standard. Federal Information Processing Standards Publication 180-1. NIST. [Online] http://www.itl.nist.gov/fipspubs/fip180-1.htm

[15] Riabov, V. and Higgs, B. CS572A Computer Security Website. [Online] http://www.rivier.edu/faculty/vriabov/cs572aweb/

[16] Riabov, V. and Higgs, B. Java Applets for Computer Security. [Online] http://www.rivier.edu/faculty/vriabov/webresos.htm

Vladimir RiabovMath Fundamentals of Computer Security 54