Encryption
Encryption
Encryption
Encryption
• Encryption is a fundamental technique used in
information security to protect the confidentiality and
integrity of data.
• It involves the process of converting plain text or data
into an encoded form called cipher-text, which can only
be accessed and understood by authorized parties with
the corresponding decryption key.
• Plain text: Unencrypted, readable, plain message that
anyone can read
• Cipher text: Result of encryption
• Key: Series of character or bits injected into algorithm
along with original message to create the encrypted
message
• Algorithm: Mathematical formula or method used to
convert unencrypted message to an encrypted message
• Decryption: Process of converting an encoded or
enciphered message back to its original form
• Two important elements are required:
– Password
Secure Communication
Needs and Requirements
• Well established needs for secure
communication
– War time communication
– Business transactions
– Illicit Love Affairs
• Requirements of secure communication
1. Secrecy
– Only intended receiver understands the message
2. Authentication
– Sender and receiver need to confirm each others
identity
3. Message Integrity
– Ensure that their communication has not been
altered, either maliciously or by accident during
Cryptography
Basics
• Cryptography comes from Greek word:
kryptos meaning hidden and graphein
mean to write.
• Cryptography is the science of secret, or
hidden writing code
• It has two main Components:
1. Encryption
– Practice of hiding messages so that they can not
be read by anyone other than the intended
recipient
2. Authentication & Integrity
– Ensuring that users of data/resources are the
persons they claim to be and that a message has
not been surreptitiously altered
Cipher
• Cipher is a method for encrypting messages
• Transformation of individual components of an
unencrypted message into encrypted component
and vice versa
Key A Key B
Key (3)
Decrypti
on
Cipher Text
Cipher:
Plain Text
Key (3)
ABCDEFGH I JKLMNOPQRSTUVWXYZ
Key
Substitution Cipher
Polyalphabetic Caesar Cipher
• Developed by Blaise de Vigenere
– Also called Vigenere cipher
• Uses a sequence of monoalpabetic ciphers in
tandem
–e.g. C1, C2, C2, C1, C2
Plain Text 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
• Example
Message: Encrypted
Cipher: Message:
Bob, I love you. Monoalphabetic Gnu, n etox dhz.
Alice Cipher tenvj
Key
Substitution Cipher
Using a key to shift alphabet
• Obtain a key to for the algorithm and then shift the
alphabets
– For instance if the key is word we will shift all the letters
by four and remove the letters w, o, r, & d from the
encryption
• We have to ensure that the mapping is one-to-one
– no single letter in plain text can map to two different
letters in cipher text
Plain Text
– ABC
no single D EinFcipher
letter G H text
I Jcan
K map
L MtoNtwo
O Pdifferent
Q R Sletters
TUV in W X text
plain YZ
Message:
Encrypted
Cipher: Message:
Bob, I love you.
??
Alice
WORD
Playfair Cipher
• not even the large number of keys in a
monoalphabetic cipher provides security
• one approach to improving security was to
encrypt multiple letters
• the Playfair Cipher is an example
• invented by Charles Wheatstone in 1854,
but named after his friend Baron Playfair
Encrypting and Decrypting
• plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
2. if both letters fall in the same row, replace each
with letter to right (wrapping back to start from
end)
3. if both letters fall in the same column, replace
each with the letter below it (again wrapping to
top from bottom)
4. otherwise each letter is replaced by the letter in
the same row and in the column of the other letter
of the pair M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Security of Playfair Cipher
• security much improved over monoalphabetic
• since have 26 x 26 = 676 digrams
• would need a 676 entry frequency table to
analyse (verses 26 for a monoalphabetic)
• and correspondingly more ciphertext
• was widely used for many years
– eg. by US & British military in WW1
• it can be broken, given a few hundred letters
• since still has much of plaintext structure
Hill Cypher
• Hill Cipher is a classic encryption method
using matrices.
• A polyalphabetic substitution cipher based
on linear algebra.
• Invented by Lester S. Hill in 1929.Uses
matrix multiplication for encryption.
• Operates on blocks of letters rather than
individual characters.
• Requires an invertible key matrix for
decryption.
• Strength lies in linear transformations and
block-based encryption.
Vernam/One-Time Pad
• An Army Signal Corp officer, Joseph Mauborgne
suggests if a truly random key as long as the
message is used, the cipher will be secure
• called a One-Time pad
• is unbreakable since ciphertext bears no statistical
relationship to the plaintext
• since for any plaintext & any ciphertext there
exists a key mapping one to other
• can only use the key once though
• problems in generation & safe distribution of key
Transposition Cipher
Columnar Transposition
• This involves rearrangement of characters on the plain
text into columns
• The following example shows how letters are
transformed
– If the letters are not exact multiples of the transposition
size there may be a few short letters in the last column
Plain Text Cipher Text
which can be padded with an infrequent letter such as x or
T Hz I S I T S S O H
S A M E S O A N I W
S A G E T H A A S O
O S H O W L R S T O
H O W A C I M G H W
O L U M N U T P I R
A R T R A S E E O A
N S P O S M R O O K
I T I O N I S T W C
W O R K S N A S N S
Row transposition
• Row Transposition Cipher is a basic transposition
cipher.
• It arranges text in a grid and permutes column
order based on a key.
• While more secure than simple transposition, it is
still breakable with cryptanalysis.
• Often used as a learning tool in cryptography.
• Rule:
– Write row by row
– Read column by column
Rail fence
• Rail Fence Cipher is a basic transposition
cipher.
• It arranges text in a zigzag pattern based on
depth.
• While historically significant, it is not secure
for modern encryption needs.
• Often used as an introductory cipher in
cryptographic learning
• sequence of diagonals and then read off as
a sequence of rows.
Ciphers
Shannon’s Characteristics of “Good” Ciphers
• The amount of secrecy needed should
determine the amount of labor
appropriate for the encryption and
decryption.
• The set of keys and the enciphering
algorithm should be free from
complexity.
• The implementation of the process
should be as simple as possible.
• Errors in ciphering should not
propagate and cause corruption of
further information in the message.
Encryption Systems
Properties of Trustworthy Systems
• It is based on sound mathematics.
– Good cryptographic algorithms are are
derived from solid principles.
• It has been analyzed by competent
experts and found to be sound.
– Since it is hard for the writer to envisage
all possible attacks on the algorithm
• It has stood the “test of time.”
– Over time people continue to review both
mathematical foundations of an algorithm
and the way it builds upon those
foundations.
– The flaws in most algorithms are
discovered soon after their release.
Cryptanalysis
Techniques
• Cryptanalysis is the process of breaking an
encryption code
– Tedious and difficult process
• Several techniques can be used to deduce the
algorithm
– Attempt to recognize patterns in encrypted
messages, to be able to break subsequent ones by
applying a straightforward decryption algorithm
– Attempt to infer some meaning without even
breaking the encryption, such as noticing an
unusual frequency of communication or
determining something by whether the
communication was short or long
– Attempt to deduce the key, in order to break
subsequent messages easily
– Attempt to find weaknesses in the implementation
or environment of use of encryption
– Attempt to find general weaknesses in an
Data Encryption Standard (DES)
Basics
• Goal of DES is to completely scramble
the data and key so that every bit of
cipher text depends on every bit of data
and ever bit of key
• DES is a block Cipher Algorithm
– Encodes plaintext in 64 bit chunks
– One parity bit for each of the 8 bytes thus
it reduces to 56 bits
• It is the most used algorithm
– Standard approved by US National Bureau
of Standards for Commercial and
nonclassified US government use in 1993
Data Encryption Standard (DES)
Basics
64-bit input 56-bit key
48-bit k1
L1 R1 • DES run in reverse
F(L1, R1, K1)
to decrypt
• Cracking DES
48-bit k2
L2 R2 – 1997: 140 days
– 1999: 14 hours
F(L2, R2, K2)
• TripleDES uses
48-bit k3
L3 R3 DES 3 times in
tandem
– Output from 1 DES
F(L16, R16, K16) is input to next DES
48-bit k16
L17 R17
Encryption Algorithm
Summary
David’s
Bob’s Bob’s
Trudeau Public Key
Message Encrypted
Cipher (Middle-man) David
+ Public key Message
Trudeau’s David’s
Trudeau’s Trudeau’s
New Message Message
Encrypted Encrypted
Cipher + public key Cipher + public key
Message Message
Asymmetric Encryption
Session-Key Encryption
• Used to improve efficiency
– Symmetric key is used for encrypting data
– Asymmetric key is used for encrypting the
symmetric key
Plain Text Cipher Cipher Text
(DES)
Send to Recipient
Encrypted
Cipher Key
(RSA)
Session Key
Message
Message Digest Digest
Algorithm
Secret Key
Password Authentication
Basics
• Password is secret character string only known
to user and server
• Message Digests commonly used for password
authentication
• Stored hash of the password is a lesser risk
– Hacker can not reverse the hash except by brute
force attack
• Problems with password based authentication
– Attacker learns password by social engineering
– Attacker cracks password by brute-force and/or
guesswork
– Eavesdrops password if it is communicated
unprotected over the network
– Replays an encrypted password back to the
authentication server
Authentication Protocols
Basics
• Set of rules that governs the communication of data related to
authentication between the server and the user
• Techniques used to build a protocol are
– Transformed password
• Password transformed using one way function before
transmission
• Prevents eavesdropping but not replay
– Challenge-response
• Server sends a random value (challenge) to the client along with
the authentication request. This must be included in the
response
• Protects against replay
– Time Stamp
• The authentication from the client to server must have time-
stamp embedded
• Server checks if the time is reasonable
• Protects against replay
• Depends on synchronization of clocks on computers
– One-time password
• New password obtained by passing user-password through one-
way function n times which keeps incrementing
• Protects against replay as well as eavesdropping
Authentication Protocols
Kerberos
• Kerberos is an authentication service that uses
symmetric key encryption and a key
distribution center.
• Kerberos Authentication server contains
symmetric keys of all users and also contains
information on which user has access privilege
to which services on the network
Authentication
Personal Tokens
• Personal Tokens are hardware devices that
generate unique strings that are usually used
in conjunction with passwords for
authentication
• Different types of tokens exist
– Storage Token: A secret value that is stored on a
token and is available after the token has been
unlocked using a PIN
– Synchronous one-time password generator: Generate
a new password periodically (e.g. each minute)
based on time and a secret code stored in the token
– Challenge-response: Token computes a number
based on a challenge value sent by the server
– Digital Signature Token: Contains the digital
signature private key and computes a computes a
digital signature on a supplied data value
Authentication
Biometrics
• Uses certain biological characteristics
for authentication
– Biometric reader measures physiological
indicia and compares them to specified
values
– It is not capable of securing information
over the network
• Different techniques exist
– Fingerprint Recognition
– Voice Recognition
– Handwriting Recognition
– Face Recognition
– Retinal Scan
Authentication
Iris Recognition
The scanning process takes
advantage of the natural patterns in
people's irises, digitizing them for
identification purposes
Facts
• Probability of two irises producing
exactly the same code: 1 in 10 to the
78th power
• Independent variables (degrees of
freedom) extracted: 266
• IrisCode record size: 512 bytes
• Operating systems compatibility: DOS
and Windows (NT/95)
• Average identification speed (database
of 100,000 IrisCode records): one to
two seconds
Authentication
Digital Signatures
• A digital signature is a data item which
accompanies or is logically associated with a
digitally encoded message.
• It has two goals
– A guarantee of the source of the data
– Proof that the data has not been tampered with
Sender’s Sender’s
Private Key Public Key
Message Digest Message
Digest
Sent to Algorithm Digest
Algorithm
Receiver
Same?
Digital
Message Signature Signature Signature Message
Digest Algorithm Sent to Algorithm Digest
Receiver
Sender Receiver
Authentication
Digital Cerftificates
• A digital certificate is a signed statement by a trusted
party that another party’s public key belongs to them.
– This allows one certificate authority to be authorized by a
different authority (root CA)
• Top level certificate must be self signed
• Any one can start a certificate authority
– Name recognition is key to some one recognizing a
certificate authority
– Verisign is industry standard certificate authority
Identity
Information
Signature
Sender’s Certificate
Algorithm
Public Key
Certificate
Authority’s
Private Key
Authentication
Cerftificates Chaining
• Chaining is the practice of signing a certificate with
another private key that has a certificate for its public
key
– Similar to the passport having the seal of the government
• It is essentially a person’s public key & some identifying
information signed by an authority’s private key
verifying the person’s identity
• The authorities public key can be used to decipher the
certificate
• The trusted
Certificateparty is Signature
called the certificate
New Certificate authority
Algorithm
Certificate
Authority’s
Private Key
Cryptanalysis
Basics
• Practice of analyzing and breaking
cryptography
• Resistance to crypt analysis is directly
proportional to the key size
– With each extra byte strength of key doubles
• Cracking Pseudo Random Number Generators
– A lot of the encryption algorithms use PRNGs to
generate keys which can also be cracked leading to
cracking of algorithms
• Variety of methods for safe guarding keys (Key
Management)
– Encryption & computer access protection
– Smart Cards