Pintu R Shah MPSTME SVKM's NMiMS Cryptography
Nov 07, 2014
Pintu R Shah MPSTME SVKM's NMiMS
Cryptography
Pintu R Shah MPSTME SVKM's NMiMS
In this chapter
• Cryptography basics• Transposition ciphers• Substitution ciphers• Data Encryption Standard• Public key cryptography• Streams and block ciphers• Key Management• Digital Signature• PEM and IPSec.
Pintu R Shah MPSTME SVKM's NMiMS
What is cryptography?
• Cryptography (from Greek word kryptosmeaning "hidden, secret"; and gráph�, "I write") is the practice and study of hiding information.
• Cryptanalysis is breaking of codes
Pintu R Shah MPSTME SVKM's NMiMS
Terminologies • Plain Text: the original information.• Cipher text: unintelligible gibberish data. It is the output
of encryption process • Encryption,is the process of converting ordinary
information (plaintext) into unintelligible gibberish (i.e., cipher text).
• Decryption is the reverse, in other words, moving from the unintelligible ciphertext back to plaintext.
• A cipher (or cypher) is a pair of algorithms which create the encryption and the reversing decryption. The detailed operation of a cipher is controlled both by the algorithm and in each instance by a key.
• Key:This is a secret parameter (ideally known only to the communicants) for a specific message exchange context.
Pintu R Shah MPSTME SVKM's NMiMS
Goals of cryptography
• Four primary goals– –Confidentiality – –Integrity – –Nonrepudiation– –Authentication
• Many applications provide multiple cryptographic benefits simultaneously– –For example: e-mail cryptography systems
Pintu R Shah MPSTME SVKM's NMiMS
Goals of Cryptography
• Confidentiality is most commonly addressed goal– –The meaning of a message is concealed by
encoding it– –The sender encrypts the message using a
cryptographic key– –The recipient decrypts the message using a
cryptographic key that may or may not be the same as the one used by the sender
Pintu R Shah MPSTME SVKM's NMiMS
Goals of Cryptography (continued)
• Integrity – –Ensures that the message received is the same as
the message that was sent– –Uses hashing to create a unique message digest
from the message that is sent along with the message– –Recipient uses the same technique to create a
second digest from the message to compare to the original one
– –This technique only protects against unintentional alteration of the message
– –A variation is used to create digital signatures to protect against malicious alteration
Pintu R Shah MPSTME SVKM's NMiMS
Goals of Cryptography (continued)
• Nonrepudiation– –The sender of a message cannot later claim
he/she did not send it– –Available with asymmetric cryptosystems
that can create digital signatures
Pintu R Shah MPSTME SVKM's NMiMS
Goals of Cryptography (continued)
• Authentication– –A user or system can prove their identity to
another who does not have personal knowledge of their identity
– –Accomplished using digital certificates– –Kerberosis a common cryptographic
authentication system
Pintu R Shah MPSTME SVKM's NMiMS
Attacks
• Opponent whose goal is to break cryptosystem is the adversary
• Kerckhoff’s principle– Assume adversary knows algorithm used, but not key
• Three types of attacks:– ciphertext only: adversary has only ciphertext; goal is
to find plaintext, possibly key– known plaintext: adversary has ciphertext,
corresponding plaintext; goal is to find key– chosen plaintext: adversary may supply plaintexts
and obtain corresponding ciphertext; goal is to find key
Pintu R Shah MPSTME SVKM's NMiMS
Cryptographic mechanism
• Symmetric key cryptography• Asymmetric key cryptography
Pintu R Shah MPSTME SVKM's NMiMS
Symmetric key cryptographic Algorithm types
• Stream ciphers: Stream ciphers operate on a single bit (byte or computer word) at a time and implement some form of feedback mechanism so that the key is constantly changing
• Block ciphers: A block cipher is so-called because the scheme encrypts one block of data at a time using the same key on each block.
• In general, the same plaintext block will always encrypt to the same cipher text when using the same key in a block cipher whereas the same plaintext will encrypt to different cipher text in a stream cipher.
Pintu R Shah MPSTME SVKM's NMiMS
Basis for Attacks
• Mathematical attacks– Based on analysis of underlying mathematics
• Statistical attacks– Make assumptions about the distribution of
letters, pairs of letters (digrams), triplets of letters (trigrams), etc.
• Called models of the language– Examine ciphertext, correlate properties with
the assumptions.
Pintu R Shah MPSTME SVKM's NMiMS
Classical Cryptography
• Sender, receiver share common key– Keys may be the same, or trivial to derive
from one another– Sometimes called symmetric cryptography
• Two basic types– Transposition ciphers– Substitution ciphers– Combinations are called product ciphers
Pintu R Shah MPSTME SVKM's NMiMS
Transposition Cipher
• Rearrange letters in plaintext to produce ciphertext
• Example (Rail-Fence Cipher)– Plaintext is HELLO W O RLD– Rearrange as
HLOOL
ELWRD
– Ciphertext is HLOOL ELWRD
Pintu R Shah MPSTME SVKM's NMiMS
Transposition Cipher (cont.)
• Keyless• Keyed • Examples
Pintu R Shah MPSTME SVKM's NMiMS
Attacking the Cipher
• Anagramming– If 1-gram frequencies match English
frequencies, but other n-gram frequencies do not, probably transposition
– Rearrange letters to form n-grams with highest frequencies
Pintu R Shah MPSTME SVKM's NMiMS
Example
• Ciphertext: HLOOLELWRD• Frequencies of 2-grams beginning with H
– HE 0.0305– HO 0.0043– HL, HW, HR, HD < 0.0010
• Frequencies of 2-grams ending in H– WH 0.0026– EH, LH, OH, RH, DH � 0.0002
• Implies E follows H
Pintu R Shah MPSTME SVKM's NMiMS
Example
• Arrange so the H and E are adjacentHE
LL
O W
OR
LD
• Read off across, then down, to get original plaintext
Pintu R Shah MPSTME SVKM's NMiMS
Substitution Ciphers
• Change characters in plaintext to produce ciphertext
• Example (Cæsar cipher)– Plaintext is HELLO W O RLD– Change each letter to the third letter following
it (X goes to A, Y to B, Z to C)• Key is 3, usually written as letter ‘D’
– Ciphertext is KHOOR ZRUOG
Pintu R Shah MPSTME SVKM's NMiMS
Attacking the Cipher
• Exhaustive search– If the key space is small enough, try all
possible keys until you find the right one– Cæsar cipher has 26 possible keys
• Statistical analysis– Compare to 1-gram model of English
Pintu R Shah MPSTME SVKM's NMiMS
Statistical Attack
• Compute frequency of each letter in ciphertext:
G 0.1 H 0.1 K 0.1 O 0.3R 0.2 U 0.1 Z 0.1
• Apply 1-gram model of English– Frequency of characters (1-grams) in English
is on next slide
Pintu R Shah MPSTME SVKM's NMiMS
Character Frequencies
0.002z0.015g
0.020y0.060s0.030m0.020f
0.005x0.065r0.035l0.130e
0.015w0.002q0.005k0.040d
0.010v0.020p0.005j0.030c
0.030u0.080o0.065i0.015b
0.090t0.070n0.060h0.080a
Pintu R Shah MPSTME SVKM's NMiMS
Statistical Analysis
• f(c) frequency of character c in ciphertext• ϕ(i) correlation of frequency of letters in
ciphertext with corresponding letters in English, assuming key is i– ϕ(i) = Σ0 � c � 25 f(c)p(c – i) so here,
ϕ(i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) + 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) + 0.1p(25 – i)
• p(x) is frequency of character x in English
Pintu R Shah MPSTME SVKM's NMiMS
Correlation: ϕ(i) for 0 � i � 25
0.0430250.06606
0.0316240.0299180.0325120.01905
0.0370230.0392170.0262110.02524
0.0380220.0322160.0635100.05753
0.0517210.0226150.026790.04102
0.0302200.0535140.020280.03641
0.0315190.0520130.044270.04820
ϕϕϕϕ(i)iϕϕϕϕ(i)iϕϕϕϕ(i)iϕϕϕϕ(i)i
Pintu R Shah MPSTME SVKM's NMiMS
The Result
• Most probable keys, based on ϕ:– i = 6, ϕ(i) = 0.0660
• plaintext EBIIL TLOLA– i = 10, ϕ(i) = 0.0635
• plaintext AXEEH PHKE W
– i = 3, ϕ(i) = 0.0575• plaintext HELLO WORLD
– i = 14, ϕ(i) = 0.0535• plaintext WTAAD LDGAS
• Only English phrase is for i = 3– That’s the key (3 or ‘D’)
Pintu R Shah MPSTME SVKM's NMiMS
Cæsar’s Problem
• Key is too short– Can be found by exhaustive search– Statistical frequencies not concealed well
• They look too much like regular English letters
• So make it longer– Multiple letters in key– Idea is to smooth the statistical frequencies to
make cryptanalysis harder
Pintu R Shah MPSTME SVKM's NMiMS
Vigènere Cipher
• Like Cæsar cipher, but use a phrase• Example
– Message THE BOY HAS THE BALL– Key VIG– Encipher using Cæsar cipher for each letter:
key VIGVIGVIGVIGVIGV
plain THEBOYHASTHEBALL
cipher OPK W WECIYOPKWIRG
Pintu R Shah MPSTME SVKM's NMiMS
Relevant Parts of Tableau
G I VA G I VB H J WE L M ZH N P CL R T GO U W JS Y A NT Z B OY E H T
• Tableau shown has relevant rows, columns only
• Example encipherments:– key V, letter T: follow V
column down to T row (giving “O”)
– Key I, letter H: follow I column down to H row (giving “P”)
Pintu R Shah MPSTME SVKM's NMiMS
Useful Terms
• period: length of key– In earlier example, period is 3
• tableau: table used to encipher and decipher– Vigènere cipher has key letters on top,
plaintext letters on the left• polyalphabetic: the key has several
different letters– Cæsar cipher is monoalphabetic
Pintu R Shah MPSTME SVKM's NMiMS
Attacking the Cipher
• Approach– Establish period; call it n– Break message into n parts, each part being
enciphered using the same key letter– Solve each part
• You can leverage one part from another
• We will show each step
Pintu R Shah MPSTME SVKM's NMiMS
The Target Cipher
• We want to break this cipher:ADQYS MIUSB OXKKT MIBHK IZOOO
EQOOG IFBAG KAUMF VVTAA CIDTW
M OCIO EQOOG BMBFV ZGG WP CIEKQ
HSNE W VECNE DLAAV RW KXS VNSVP
HCEUT QOIOF MEGJS WTPCH AJM OC
HIUIX
Pintu R Shah MPSTME SVKM's NMiMS
Establish Period
• Kaskski: repetitions in the ciphertext occur when characters of the key appear over the same characters in the plaintext
• Example:key VIGVIGVIGVIGVIGV
plain THEBOYHASTHEBALL
cipher OPKW W ECIYOPK WIRG
Note the key and plaintext line up over the repetitions (underlined). As distance between repetitions is 9, the period is a factor of 9 (that is, 1, 3, or 9)
Pintu R Shah MPSTME SVKM's NMiMS
Repetitions in Example
2, 36124118CH
339794SV
2, 368377NE
2, 2, 2, 2, 34811769 PC
7, 74910556Q O
2, 2, 2, 3, 37212250M OC
2, 2, 11448743AA
2, 2, 2, 3246339FV
2, 3, 5305424OEQOO G
552722O O
2, 510155MI
FactorsDistanceEndStartLetters
Pintu R Shah MPSTME SVKM's NMiMS
Estimate of Period
• OEQOOG is probably not a coincidence– It’s too long for that– Period may be 1, 2, 3, 5, 6, 10, 15, or 30
• Most others (7/10) have 2 in their factors• Almost as many (6/10) have 3 in their
factors• Begin with period of 2 × 3 = 6
Pintu R Shah MPSTME SVKM's NMiMS
Check on Period
• Index of coincidence is probability that two randomly chosen letters from ciphertextwill be the same
• Tabulated for different periods:1 0.066 3 0.047 5 0.0442 0.052 4 0.045 10 0.041Large 0.038
Pintu R Shah MPSTME SVKM's NMiMS
Compute IC
• IC = [n (n – 1)]–1 Σ0�i�25 [Fi (Fi – 1)]– where n is length of ciphertext and Fi the
number of times character i occurs in ciphertext
• Here, IC = 0.043– Indicates a key of slightly more than 5– A statistical measure, so it can be in error, but
it agrees with the previous estimate (which was 6)
Pintu R Shah MPSTME SVKM's NMiMS
Splitting Into Alphabets
alphabet 1: AIKHOIATTOBGEEERNEOSAIalphabet 2: DUKKEFUA WEM GK WD W SUF WJUalphabet 3: QSTIQBMAMQB W QVLKVTMTMIalphabet 4: YBMZOAFCOOFPHEAXPQEPOXalphabet 5: SOIOOGVICOVCSVASHOGCCalphabet 6: MXBOGKVDIGZINNVVCIJHH• ICs (#1, 0.069; #2, 0.078; #3, 0.078; #4, 0.056;
#5, 0.124; #6, 0.043) indicate all alphabets have period 1, except #4 and #6; assume statistics off
Pintu R Shah MPSTME SVKM's NMiMS
Frequency Examination
ABCDEFGHIJKLMNOPQRSTUV WXYZ
1 31004011301001300112000000
2 10022210013010000010404000
3 12000000201140004013021000
4 21102201000010431000000211
5 10500021200000500030020000
6 01110022311012100000030101
Letter frequencies are (H high, M medium, L low):HM M MHM MHH M M M MHHMLHHHMLLLLL
Pintu R Shah MPSTME SVKM's NMiMS
Begin Decryption
• First matches characteristics of unshiftedalphabet
• Third matches if I shifted to A• Sixth matches if V shifted to A• Substitute into ciphertext (bold are substitutions)ADIYS RIUKB OCKKL MIGHK AZOTO EIOOL IFTAG PAUEF VATAS CIITW EOCNO EIOOL BMTFV EGGOP CNEKI HSSE W NECSEDDAAA R WCXS ANSNP HHEUL QONOF EEGOS WLPCM AJEOC MIUAX
Pintu R Shah MPSTME SVKM's NMiMS
Look For Clues
• AJE in last line suggests “are”, meaning second alphabet maps A into S:ALIYS RICKB OCKSL MIGHS AZOTOMIOOL INTAG PACEF VATIS CIITEEOCNO MIOOL BUTFV EGOOP CNESIHSSEE NECSE LDAAA RECXS ANANPHHECL QONON EEGOS ELPCM AREOCMICAX
Pintu R Shah MPSTME SVKM's NMiMS
Next Alphabet
• MICAX in last line suggests “mical” (a common ending for an adjective), meaning fourth alphabet maps O into A:ALIMS RICKP OCKSL AIGHS ANOTO MICOL INTOG PACET VATIS QIITE ECCNO MICOL BUTTV EGOOD CNESI VSSEE NSCSE LDOAA RECLS ANAND HHECL EONON ESGOS ELDCM ARECC MICAL
Pintu R Shah MPSTME SVKM's NMiMS
Got It!
• QI means that U maps into I, as Q is always followed by U:ALIME RICKP ACKSL AUGHS ANATO MICAL INTOS PACET HATIS QUITE ECONO MICAL BUTTH EGOOD ONESI VESEE NSOSE LDOMA RECLE ANAND THECL EANON ESSOS ELDOM ARECO MICAL
A LIMERICK PACKS LAUGHS ANATOMICAL INTO SPACE THAT IS QUITE ECONO MICAL BUT THE GOOD ONES I ‘VE SEENSO SELDO M ARE CLEAN AND THE CLEAN ONES SO SELDOM ARE COMICAL
Pintu R Shah MPSTME SVKM's NMiMS
One-Time Pad
• A Vigenère cipher with a random key at least as long as the message– Provably unbreakable– Why? Look at ciphertext DXQR. Equally likely to
correspond to plaintext DOIT (key AJIY) and to plaintext DONT (key AJDY) and any other 4 letters
– Warning: keys must be random, or you can attack the cipher by trying to regenerate the key
• Approximations, such as using pseudorandom number generators to generate keys, are not random
Pintu R Shah MPSTME SVKM's NMiMS
Overview of the DES
• A block cipher:– encrypts blocks of 64 bits using a 64 bit key– outputs 64 bits of ciphertext
• A product cipher– basic unit is the bit– performs both substitution and transposition
(permutation) on the bits• Cipher consists of 16 rounds (iterations) each
with a round key generated from the user-supplied key
Pintu R Shah MPSTME SVKM's NMiMS
Generation of Round Keys
key
PC-1
C0 D0
LSH LSH
D1
PC-2 K1
K16LSH LSH
C1
PC-2
• Round keys are 48 bits each
Pintu R Shah MPSTME SVKM's NMiMS
Encipherment
input
IP
L0 R0
⊕ f K1
L1 = R0 R1 = L0 ⊕ f(R0, K1)
R16 = L15 - f(R15, K16) L16 = R15
IPŠ1
output
Pintu R Shah MPSTME SVKM's NMiMS
The f Function
RiŠ1 (32 bits)
E
RiŠ1 (48 bits)
Ki (48 bits)
⊕
S1 S2 S3 S4 S5 S6 S7 S8
6 bits into each
P
32 bits
4 bits out of each
Pintu R Shah MPSTME SVKM's NMiMS
Controversy
• Considered too weak– Diffie, Hellman said in a few years technology
would allow DES to be broken in days• Design using 1999 technology published
– Design decisions not public• S-boxes may have backdoors
Pintu R Shah MPSTME SVKM's NMiMS
Undesirable Properties
• 4 weak keys– They are their own inverses
• 12 semi-weak keys– Each has another semi-weak key as inverse
• Complementation property– DESk(m) = c � DESk′(m′) = c′
• S-boxes exhibit irregular properties– Distribution of odd, even numbers non-random– Outputs of fourth box depends on input to third box
Pintu R Shah MPSTME SVKM's NMiMS
Differential Cryptanalysis
• A chosen ciphertext attack– Requires 247 plaintext, ciphertext pairs
• Revealed several properties– Small changes in S-boxes reduce the number of pairs
needed– Making every bit of the round keys independent does
not impede attack• Linear cryptanalysis improves result
– Requires 243 plaintext, ciphertext pairs
Pintu R Shah MPSTME SVKM's NMiMS
DES Modes
• Electronic Code Book Mode (ECB)– Encipher each block independently
• Cipher Block Chaining Mode (CBC)– Xor each block with previous ciphertext block– Requires an initialization vector for the first one
• Encrypt-Decrypt-Encrypt Mode (2 keys: k, k′)– c = DESk(DESk′
–1(DESk(m)))• Encrypt-Encrypt-Encrypt Mode (3 keys: k, k′, k′′)
– c = DESk(DESk′ (DESk′′(m)))
Pintu R Shah MPSTME SVKM's NMiMS
CBC Mode Encryption
⊕
init. vector m1
DES
c1
⊕
m2
DES
c2
sent sent
…
…
…
Pintu R Shah MPSTME SVKM's NMiMS
CBC Mode Decryption
⊕
init. vector c1
DES
m1
…
…
…
⊕
c2
DES
m2
Pintu R Shah MPSTME SVKM's NMiMS
Self-Healing Property
• Initial message– 3231343336353837 3231343336353837 3231343336353837 3231343336353837
• Received as (underlined 4c should be 4b)– ef7c4cb2b4ce6f3b f6266e3a97af0e2c 746ab9a6308f4256 33e60b451b09603d
• Which decrypts to– efca61e19f4836f1 3231333336353837 3231343336353837 3231343336353837
– Incorrect bytes underlined– Plaintext “heals” after 2 blocks
Pintu R Shah MPSTME SVKM's NMiMS
Current Status of DES
• Design for computer system, associated software that could break any DES-enciphered message in a few days published in 1998
• Several challenges to break DES messages solved using distributed computing
• NIST selected Rijndael as Advanced Encryption Standard, successor to DES– Designed to withstand attacks that were successful
on DES
Pintu R Shah MPSTME SVKM's NMiMS
Public Key Cryptography
• Two keys– Private key known only to individual– Public key available to anyone
• Public key, private key inverses
• Idea– Confidentiality: encipher using public key,
decipher using private key– Integrity/authentication: encipher using private
key, decipher using public one
Pintu R Shah MPSTME SVKM's NMiMS
Requirements
1. It must be computationally easy to encipher or decipher a message given the appropriate key
2. It must be computationally infeasible to derive the private key from the public key
3. It must be computationally infeasible to determine the private key from a chosen plaintext attack
Pintu R Shah MPSTME SVKM's NMiMS
RSA
• Exponentiation cipher• Relies on the difficulty of determining the
number of numbers relatively prime to a large integer n
Pintu R Shah MPSTME SVKM's NMiMS
Background
• Totient function φ(n)– Number of positive integers less than n and relatively
prime to n• Relatively prime means with no factors in common with n
• Example: φ(10) = 4– 1, 3, 7, 9 are relatively prime to 10
• Example: φ(21) = 12– 1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20 are relatively
prime to 21
Pintu R Shah MPSTME SVKM's NMiMS
Algorithm
• Choose two large prime numbers p, q– Let n = pq; then φ(n) = (p–1)(q–1)– Choose e < n such that e is relatively prime to
φ(n).– Compute d such that ed mod φ(n) = 1
• Public key: (e, n); private key: d• Encipher: c = me mod n• Decipher: m = cd mod n
Pintu R Shah MPSTME SVKM's NMiMS
Example: Confidentiality
• Take p = 7, q = 11, so n = 77 and φ(n) = 60• Alice chooses e = 17, making d = 53• Bob wants to send Alice secret message HELLO
(07 04 11 11 14)– 0717 mod 77 = 28– 0417 mod 77 = 16– 1117 mod 77 = 44– 1117 mod 77 = 44– 1417 mod 77 = 42
• Bob sends 28 16 44 44 42
Pintu R Shah MPSTME SVKM's NMiMS
Example
• Alice receives 28 16 44 44 42• Alice uses private key, d = 53, to decrypt
message:– 2853 mod 77 = 07– 1653 mod 77 = 04– 4453 mod 77 = 11– 4453 mod 77 = 11– 4253 mod 77 = 14
• Alice translates message to letters to read HELLO– No one else could read it, as only Alice knows her
private key and that is needed for decryption
Pintu R Shah MPSTME SVKM's NMiMS
Example: Integrity/Authentication
• Take p = 7, q = 11, so n = 77 and φ(n) = 60• Alice chooses e = 17, making d = 53• Alice wants to send Bob message HELLO (07 04 11 11
14) so Bob knows it is what Alice sent (no changes in transit, and authenticated)– 0753 mod 77 = 35– 0453 mod 77 = 09– 1153 mod 77 = 44– 1153 mod 77 = 44– 1453 mod 77 = 49
• Alice sends 35 09 44 44 49
Pintu R Shah MPSTME SVKM's NMiMS
Example• Bob receives 35 09 44 44 49• Bob uses Alice’s public key, e = 17, n = 77, to decrypt message:
– 3517 mod 77 = 07– 0917 mod 77 = 04– 4417 mod 77 = 11– 4417 mod 77 = 11– 4917 mod 77 = 14
• Bob translates message to letters to read HELLO– Alice sent it as only she knows her private key, so no one else could
have enciphered it– If (enciphered) message’s blocks (letters) altered in transit, would not
decrypt properly
Pintu R Shah MPSTME SVKM's NMiMS
Example: Both• Alice wants to send Bob message HELLO both
enciphered and authenticated (integrity-checked)– Alice’s keys: public (17, 77); private: 53– Bob’s keys: public: (37, 77); private: 13
• Alice enciphers HELLO (07 04 11 11 14):– (0753 mod 77)37 mod 77 = 07– (0453 mod 77)37 mod 77 = 37– (1153 mod 77)37 mod 77 = 44– (1153 mod 77)37 mod 77 = 44– (1453 mod 77)37 mod 77 = 14
• Alice sends 07 37 44 44 14
Pintu R Shah MPSTME SVKM's NMiMS
Security Services
• Confidentiality– Only the owner of the private key knows it, so
text enciphered with public key cannot be read by anyone except the owner of the private key
• Authentication– Only the owner of the private key knows it, so
text enciphered with private key must have been generated by the owner
Pintu R Shah MPSTME SVKM's NMiMS
More Security Services
• Integrity– Enciphered letters cannot be changed
undetectably without knowing private key
• Non-Repudiation– Message enciphered with private key came
from someone who knew it
Pintu R Shah MPSTME SVKM's NMiMS
Warnings
• Encipher message in blocks considerably larger than the examples here– If 1 character per block, RSA can be broken
using statistical attacks (just like classical cryptosystems)
– Attacker cannot alter letters, but can rearrange them and alter message meaning
• Example: reverse enciphered message of text ON to get NO
Pintu R Shah MPSTME SVKM's NMiMS
Key distribution problem
• For n persons, we require n * (n-1)/2 keys.• Solution is trusted intermediary.• For symmetric key cryptography, we call
key distribution center (KDC)• For public key cryptography, we call
certification authority (CA)
Pintu R Shah MPSTME SVKM's NMiMS
Comparison
Pintu R Shah MPSTME SVKM's NMiMS
Combining symmetric and asymmetric cryptography
Pintu R Shah MPSTME SVKM's NMiMS
Key wrapping
Pintu R Shah MPSTME SVKM's NMiMS
Diffie Hellman key exchange/ agreement algorithm
• DH key exchange algorithm can be used only for key agreement but not for encryption or decryption of messages.
Pintu R Shah MPSTME SVKM's NMiMS
DH algorithm
Pintu R Shah MPSTME SVKM's NMiMS
Example
Pintu R Shah MPSTME SVKM's NMiMS
Problem with the algorithm
• MITM attack or bucket brigade attack
Pintu R Shah MPSTME SVKM's NMiMS
Asymmetric key operation
Pintu R Shah MPSTME SVKM's NMiMS
Key Distribution Center (KDC)
�������� ��
������� ��������� ����
������������ ���������
��������������������������������� ����������� ������������������������������
� � � � ������� ����� ����!������������������������������������������������������������ ��������������"�
�� �����������
�
KB-KDC(A,R1)
KA-KDC(A,B)
KA-KDC(R1, KB-KDC(A,R1) )
Pintu R Shah MPSTME SVKM's NMiMS
Certification Authorities• Certification authority (CA): binds public key to particular entity, E.• E (person, router) registers its public key with CA.
– E provides “proof of identity” to CA. – CA creates certificate binding E to its public key.– certificate containing E’s public key digitally signed by CA –
CA says “this is E’s public key”
���#�������
�������$
���#�������������������������
���������������%�������&
�����'���
������ �(
���$
�������������������#�����������!�
��������� �
Pintu R Shah MPSTME SVKM's NMiMS
Certification Authorities• When Alice wants Bob’s public key:
– gets Bob’s certificate (Bob or elsewhere).– apply CA’s public key to Bob’s certificate,
get Bob’s public key���#�������
�������$
���������������%�������&
��������
������ �$
���$
Pintu R Shah MPSTME SVKM's NMiMS
A certificate contains:• Serial number (unique to issuer)• info about certificate owner, including
algorithm and key value itself (not shown)• info about certificate issuer
• valid dates• digital
signature by issuer
Pintu R Shah MPSTME SVKM's NMiMS
Digital Signatures
Cryptographic technique analogous to hand-written signatures.
• sender (Bob) digitally signs document, establishing he is document owner/creator.
• verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document
Pintu R Shah MPSTME SVKM's NMiMS
Digital Signatures
Simple digital signature for message m:• Bob signs m by encrypting with his private
key KB, creating “signed” message, KB(m)((
Dear AliceOh, how I have missed you. I think of you all the time! …(blah blah blah)
Bob
���#������!��
)����������������������������
���#����'�������
���(
Bob’s message, m, signed
(encrypted) with his private key
���(%�&
Pintu R Shah MPSTME SVKM's NMiMS
Digital Signatures (more)• Suppose Alice receives msg m, digital signature KB(m)
• Alice verifies m signed by Bob by applying Bob’s public key KB to KB(m) then checks.+
+
-
-
Alice thus verifies that:üBob signed m.üNo one else signed m.üBob signed m and not m’.
Non-repudiation:�Alice can take m, and signature KB(m) to
court and prove that Bob signed m.
-
Pintu R Shah MPSTME SVKM's NMiMS
Message Digests
Computationally expensive to public-key-encrypt long messages
Goal: fixed-length, easy-to-compute digital “fingerprint”
• apply hash function H to m, get fixed size message digest, H(m).
Hash function properties:• many-to-1• produces fixed-size msg
digest (fingerprint)• given message digest x,
computationally infeasible to find m such that x = H(m)
�����������
�
� ��� ��*�������
� %�&
Pintu R Shah MPSTME SVKM's NMiMS
Internet checksum: poor crypto hash function
Internet checksum has some properties of hash function:ü produces fixed length digest (16-bit sum) of messageü is many-to-one
But given message with given hash value, it is easy to find another message with same hash value:
I O U 10 0 . 99 B O B
49 4F 55 3130 30 2E 3939 42 4F 42
����� �+ ,,�������
B2 C1 D2 AC
I O U 90 0 . 19 B O B
49 4F 55 3930 30 2E 3139 42 4F 42
����� �+ ,,�������
B2 C1 D2 AC������������������������������������-
Pintu R Shah MPSTME SVKM's NMiMS
�����������
�� ��� ���������� � %�&
���������������%�������&
���#����'���
���� ���(
$
Bob sends digitally signed message:
Alice verifies signature and integrity of digitally signed message:
��%� %�&&(
������������������
��%� %�&&(
������������������
�����������
�
� ��� ����������
� %�&
���������������%�������&
� %�&
���#�������
���� ���$
�.���"
Digital signature = signed message digest
Pintu R Shah MPSTME SVKM's NMiMS
Hash Function Algorithms• MD5 hash function widely used (RFC 1321)
– computes 128-bit message digest in 4-step process.
– arbitrary 128-bit string x, appears difficult to construct msg m whose MD5 hash is equal to x.
• SHA-1 is also used.– US standard [NIST, FIPS PUB 180-1]
– 160-bit message digest
Pintu R Shah MPSTME SVKM's NMiMS
Message Digest• A cryptographic hash function is a transformation that
takes an input (or 'message') and returns a fixed-size string, which is called the hash value (sometimes termed a message digest, a digital fingerprint, a digest or a checksum).
• The ideal hash function has three main properties – it is extremely easy to calculate a hash for any given data.– it is extremely difficult or almost impossible in a practical sense
to calculate a text that has a given hash.– it is extremely unlikely that two different messages, however
close, will have the same hash.
Pintu R Shah MPSTME SVKM's NMiMS
MD and Digital Signature• There are several reasons to sign such a hash (or
message digest) instead of the whole document.– For efficiency: The signature will be much shorter and thus
save time since hashing is generally much faster than signing inpractice.
– For compatibility: Messages are typically bit strings, but some signature schemes operate on other domains (such as, in the case of RSA, numbers modulo a composite number N). A hash function can be used to convert an arbitrary input into the proper format.
– For integrity: Without the hash function, the text "to be signed" may have to be split (separated) in blocks small enough for the signature scheme to act on them directly. However, the receiver of the signed blocks is not able to recognize if all the blocks are present and in the appropriate order.
Pintu R Shah MPSTME SVKM's NMiMS
How Digital Signature works
Pintu R Shah MPSTME SVKM's NMiMS
IPSec
• Network layer security• Set of protocols and mechanisms to
provide CIA• Operates in two modes
– Transport mode– Tunnel mode
Pintu R Shah MPSTME SVKM's NMiMS
Transport mode
Pintu R Shah MPSTME SVKM's NMiMS
Tunnel mode
Pintu R Shah MPSTME SVKM's NMiMS
AH
Pintu R Shah MPSTME SVKM's NMiMS
The AH protocol provides message authentication and integrity,
but not privacy.
Note:Note:
Pintu R Shah MPSTME SVKM's NMiMS
ESP
Pintu R Shah MPSTME SVKM's NMiMS
ESP provides message authentication, integrity, and privacy.
Note:Note:
Pintu R Shah MPSTME SVKM's NMiMS
Privacy Enhanced E-mail (PEM)
• Design goals– Not to redesign existing mail system or
protocols– To be compatible with MTA’a and UA’s– To provide confidentiality, authentication data
integrity and if possible, non repudiation• Uses two keys: data encipherment key
(DEC) and interchange key• DEC is a one time use random key