Session 2 - Lecture Notes Crypto Part 1
Session 2 - Lecture Notes Crypto Part 1
plan-protect-respond cycle
3 - 2
CRYPTOGRAPHY AND SECURITY
OBJECTIVES
Cryptography is the use of mathematical operations to protect messages
traveling between parties or stored on a computer
• Integrity means that the message cannot be changed or, if it is changeg, that
this change will be detected
3 - 3
ENCRYPTION – A CRYPTO
TECHNIQUE
• The two parties using the cipher also need to know a secret key (or keys)
Key: a (long) stream of bits (1s and 0s)
The key or keys must be kept secret. Cryptanalysts attempt to crack (find) the
key
3 - 4
SYMMETRIC KEY ENCRYPTION FOR
CONFIDENTIALITY
3 - 5
Plaintext Key Ciphertext
EXAMPLE
n 4 r
SYMMETRIC KEY o 8 w
CIPHER w 15 l
(SUBSTITUTION) i 16 …
s 23 …
t 16 …
+4 h 3 …
e 9 …
n o p q r
t 12 …
This is a very weak cipher.
i 20 …
Real ciphers use complex m 6 …
math. e 25 …
3 - 6
TYPES OF SYMMETRIC CIPHERS
• Substitution Ciphers
Substitute one letter (or bit) for another in each place
• Transposition Ciphers
Transposition ciphers do not change individual letters or bits, but they change
their order
3 - 7
TRANSPOSITION CIPHER
Key (Part 1)
Key (Part 2) 1 3 2
2
3
1
Key = 132 231
3 - 8
• The order of adding letters to the cipher text
Column 1, row 1; col 1. row 2; col 1 , row3; col 2, row 1; col 2, row 2 ; col 2, row 3; col3,
ro1; col3,row 2;col 3,row 3
I.e. the fist letter r in the cipher text will be the one that is in the cell with 1 in part 1 and 1
in part 2
the second letter in the cipher text will be the one that is in the cell with 1 in part 1 and 2
in part 2
….
P L A I N T E X T S N A K E C O B R A . B L O C K S O F 9 L E T T E R S . F I R S T
B L O C K I S S N A K E C O B R
1 , 1 I S L E T T E R O
1 , 2 I S L E T T E R S
1 . 3 L E T T E R K
2 . 1 L E T T E R R
2 . 2 L E T T E R A
2 . 3 L E T T E R C
3 . 1 B
3 . 2 N
3 . 3 E
C I P H E R T E X T I S O S K R A C B N E
1 3 2
2 s n a
3 k e c
1 o b r
CODES
• Ciphers : can encrypt any message expressed in binary
(1s and 0s). Felxible, fast ciphers dominant for
encryption today
3 - 1 1
• Ciphers : can encrypt any message expressed in binary Message Code
(1s and 0s). Flexible, fast. Ciphers dominant for
encryption today From 17434
• Codebooks: more complex. for example, substitute
anotherJword
Akagi 63717
A PorAa N
number
ESE for a word
N AVA L To 83971
O P E R AT I O N A L
Truk 11131
CODE JN-25
(SIMPLIFIED) STOP 34058
ETA 53764
Transmitted: 6 PM 73104
174346371783971… STOP 26733
Require 29798
B 72135
N 54678
STOP 61552
3 - 1 2
3KEY LENGTH AND EXHAUSTIVE
SEARCH TIME
Key Length in Number of Possible Keys
Bits Each extra bit
doubles the number
1 of keys 2
2 4
4 16
8 256
16 65,536
40 1,099,511,627,776
56 72,057,594,037,927,900
112 5,192,296,858,534,830,000,000,000,000,000,000
112 5.1923E+33
168 Shaded keys are 3.74144E+50
256 Strong symmetric 1.15792E+77
512 keys (>=100 bits) 1.3408E+154
3 - 1 3
MAJOR SYMMETRIC KEY
ENCRYPTION CIPHERS
RC4 DES 3DES AES
Key Length 40 bits or 56 112 or 168 128, 192, or
(bits) more 256
Key Strength Very weak at Weak Strong Strong
40 bits
Processing Low Moderate High Low
Requirements
RAM Low Moderate Moderate Low
Requirements
Remarks Can use keys Created in Applies Today’s gold
of variable the 1970s DES three standard for
length times with symmetric
two or three key
different encryption
DES keys
3 - 1 4
D E S ( D AT A E N C R Y P T I O N S TA N D A R D ) :
BLOCK ENCRYPTION
3 - 1 5
CRYPTOGRAPHIC SYSTEMS AND
S TA G E S
• (Crypto protections are organized into complete
cryptographic systems that provide a broad set of
cryptographic protection. Operate as a sequence of
stages)
3 - 1 6
S TA G E 1 : S E L E C T E D S S L / T L S C I P H E R
SUITES
Cipher Suite Key Digital Symmetric Hashing Strength
Negotiation Signature Key Method
Method Encryption for
Method HMAC
3 - 1 7
S TA G E 2 : A U T H E N T I C AT I O N
3 - 1 8
HASHING: A CRYPTO TECHNIQUE
• A hashing algorithm can be applied to a bit string of any length
• The result of the calculation is called the hash
• For a given hashing algorithm, all hashes are pf the same short length
• Used in authentication protocols
3 - 1 9
H A S H I N G & E N C RY P T I O N C O M PA R E D
3 - 2 0
HASHING ALGORITHMS
SHA-224, SHA-256, SHA-384, and SHA-512 (name gives hash length in bits)
Note: MD5 and SHA-1 should not be used because they have been shown to be unsecure
3 - 2 1
P R O TO C O L ( PAR T O F S TAG E 2 ) . C O M P R I S E S A
DIALOGUE,7 EXCHANGES
3 - 2 2
3 - 2 3
S TA G E 3 : K E Y I N G ( T H E
SThere
E are
CtwoUtypes
R ofEciphersEused
X forCconfidentiality
HANGE OF
In symmetric key encryption for confidentiality, the two sides
S EuseCtheRsame
ET key.SFor)each dialogue (session), a new
symmetric key is generated: the symmetric session key. There
is a need to transmit the symmetric key from one party to
other
3 - 2 5
HOW IS IT USED: PUBLIC KEY KEYING FOR
SYMMETRIC SESSION KEYS
3 - 2 6
ANOTHER APPROACH TO KEYING:
THE DIFFIE-HELLMAN KEY
AGREEMENT
• The two parties exchange parameters p and g
3 - 2 7
A B I T O F M AT H : K E Y I N G U S I N G T H E D I F F I E -
HELLMAN ALGORITHM
3 - 2 8
MORE….HOMEWORK
• https://www.encryptionconsulting.com/diffie-hellman-key-exchange-vs-rsa explained
• https://www.youtube.com/watch?v=M-0qt6tdHzk&vl=en explained