01-Introduction To Cryptography
01-Introduction To Cryptography
OVERVIEW
Cryptography
Definition
Terminology
History
Goal and Services
Types of Cryptography
Symmetric Key Cryptography
Asymmetric Key Cryptography
Hash Functions
CRYPTOGRAPHY
Definition
Terminology
History
Goal and Services
Cryptography
Definition
Phil Zimmermann
Bruce Schneier
The art and science of concealing the messages to introduce secrecy in information
security is recognized as cryptography.
Cryptography
Terminologies
A message is plaintext (sometimes called cleartext). The process of disguising a message in such a way
as to hide its substance is encryption. An encrypted message is ciphertext. The process of turning
ciphertext back into plaintext is decryption.
A cipher (or cypher) is an algorithm for performing encryption or decryption—a series of well-defined
steps that can be followed as a procedure.
Cryptography
Terminology
A cryptosystem is an implementation of cryptographic techniques and their accompanying infrastructure to
provide information security services. A cryptosystem is also referred to as a cipher system. The various
components of a basic cryptosystem are as follows −
Plaintext
Encryption Algorithm
Ciphertext
Decryption Algorithm
Encryption Key
Decryption Key
Cryptography
Terminology
While cryptography is the science of securing data, cryptanalysis is the science of analyzing and
breaking secure communication. Classical cryptanalysis involves an interesting combination of
analytical reasoning, application of mathematical tools, pattern finding, patience, determination,
and luck. Cryptanalysts are also called attackers.
Cryptology embraces both cryptography and cryptanalysis.
Substitution Method
Encryption Decryption
Round and round the mulberry bush the monkey chased the weasel
rudnrudhmlerbsteokyhsdhwae
onadonteubryuhhmnecaeteesl
Becomes:
rudnrudhmlerbsteokyhsdhwaeonadonteubryuhhmnecaeteesl
XOR CIPHER
Goal: The primary goal of cryptography is to secure important data on the hard disk or
as it passes through a medium that may not be secure itself. Usually, that medium is a
computer network.
Confidentiality (secrecy)
•Ensuring that no one can read the message except the intended receiver
•Data is kept secret from those without the proper credentials, even if that
data travels through an insecure medium
Integrity (anti-tampering)
•Assuring the receiver that the received message has not been altered in
any way from the original.
Cryptography
Goal and Services
Authentication
Cryptography can help establish identity for authentication purposes The
process of proving one's identity. (The primary forms of host-to-host
authentication on the Internet today are name-based or address-based,
both of which are notoriously weak.)
Non-repudiation
A mechanism to prove that the sender really sent this message
Types of Cryptography
Symmetric Key Cryptography
Asymmetric Key Cryptography
Hash Functions
Types of Cryptography
Symmetric Key Cryptography
Also known as Secret Key Cryptography or Conventional Cryptography, Symmetric Key
Cryptography is an encryption system in which the sender and receiver of a message share a
single, common key that is used to encrypt and decrypt the message.
The Algorithm use is also known as a secret key algorithm or sometimes called a symmetric
algorithm
Each AES cipher has a 128-bit block size, with key sizes of 128, 192 and 256 bits, respectively. The AES
ciphers have been analyzed extensively and are now used worldwide, as was the case with its predecessor,
the Data Encryption Standard (DES).
Types of Cryptography
Symmetric Key Cryptography
Lucifer - Madryga
FEAL - REDOC
LOKI - GOST
CAST - Blowfish
Safer - Crab
RC5 -
Types of Cryptography
Problems with Conventional Cryptography
Key Management
Symmetric-key systems are simpler and faster; their main drawback is that the two parties must
somehow exchange the key in a secure way and keep it secure after that.
Key Management caused nightmare for the parties using the symmetric key cryptography. They were
worried about how to get the keys safely and securely across to all users so that the decryption of the
message would be possible. This gave the chance for third parties to intercept the keys in transit to
decode the top-secret messages. Thus, if the key was compromised, the entire coding system was
compromised and a “Secret” would no longer remain a “Secret”.
The basic technique of public key cryptography was first discovered in 1973 by the British Clifford Cocks of
Communications-Electronics Security Group (CESG) of (Government Communications Headquarters - GCHQ)
but this was a secret until 1997.
Types of Cryptography
Asymmetric Key Cryptography - Examples
Digital Signature Standard (DSS) is the digital signature algorithm (DSA) developed by the U.S. National Security
Agency (NSA) to generate a digital signature for the authentication of electronic documents. DSS was put forth
by the National Institute of Standards and Technology (NIST) in 1994, and has become the United States
government standard for authentication of electronic documents. DSS is specified in Federal Information
Processing Standard (FIPS) 186.
Types of Cryptography
Asymmetric Key Cryptography - Examples
Algorithm - RSA
RSA (Rivest, Shamir and Adleman who first publicly described it in 1977) is an algorithm for public-key
cryptography. It is the first algorithm known to be suitable for signing as well as encryption, and one of
the first great advances in public key cryptography.
RSA is widely used in electronic commerce protocols, and is believed to be secure given sufficiently long
keys and the use of up-to-date implementations.
Types of Cryptography
Asymmetric Key Cryptography - Examples ElGamal
ElGamal is a public key method that is used in both encryption and digital signing.
The encryption algorithm is similar in nature to the Diffie-Hellman key agreement protocol
It is used in many applications and uses discrete logarithms.
ElGamal encryption is used in the free GNU Privacy Guard software
Hash Functions
What is a Hash Function
Note
The initial and final permutations are straight P-boxes that are inverses
of each other.
They have no cryptography significance in DES.
6.2.2 Rounds
Figure 6.4
A round in DES
(encryption site)
6.2.2 Continued
DES Function
The heart of DES is the DES function. The DES function applies a 48-bit key to
the rightmost 32 bits to produce a 32-bit output.
Figure 6.5
DES function
6.2.2 Continue
Expansion P-box
Since RI−1 is a 32-bit input and KI is a 48-bit key, we first need to expand RI−1 to
48 bits.
Although the relationship between the input and output can be defined
mathematically, DES uses Table 6.2 to define this P-box.
Whitener (XOR)
After the expansion permutation, DES uses the XOR operation on the expanded
right section and the round key. Note that both the right section and the key are
48-bits in length. Also note that the round key is used only in this operation.
6.2.2 Continue
S-Boxes
The S-boxes do the real mixing (confusion). DES uses 8 S-boxes, each with a 6-
bit input and a 4-bit output. See Figure 6.7.
Table 6.3 shows the permutation for S-box 1. For the rest of the boxes see the
textbook.
Using mixers and swappers, we can create the cipher and reverse cipher, each
having 16 rounds.
First Approach
To achieve this goal, one approach is to make the last round (round 16)
different from the others; it has only a mixer and no swapper.
Note
In the first approach, there is no swapper in the last round.
Figure 6.9 DES cipher and reverse cipher for the first approach
6.2.3 Continued
6.53
6.2.3 Continued
Alternative Approach
We can make all 16 rounds the same by including one swapper to the 16th
round and add an extra swapper after that (two swappers cancel the effect of
each other).
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key.
6.2.3 Continued
Figure 6.10
Key generation
6.2.3 Continued
6.57
6.2.3 Continued
6.58
6.2.3 Continued
6.59
6.2.3 Continued
6.60
RSA Cryptosystem
The system works on a public and private key system. The public key is made
available to everyone.
With this key a user can encrypt data but cannot decrypt it.
The only person who can decrypt it is the one who possesses the private key.
It is theoretically extremely difficult to generate the private key from the public
key.
This makes the RSA algorithm a very popular choice in data encryption
Key Generation Algorithm
Choose an odd public exponent e, 1 < e < φ(n) such that: gcd(e, φ(n)) = 1
Compute the private exponent d, 1 < d < φ(n) such that: ed ≡ 1 (mod φ(n))
Key Generation Algorithm
30.65
Encryption & Decryption
Encryption
The encryption operation in the RSA cryptosystem is exponentiation to the e
th power modulo n:
c = ENCRYPT (m) = me mod n
The input m is the message.
The output c is the resulting cipher text.
Decryption
The decryption operation is exponentiation to the d th power modulo n:
The message m can be found form the cipher text C by the equation
m = DECRYPT (c) = Cd mod n
Key Pair Generation
Example
Take Primes:
p = 5, q = 11
Compute n:
n = pq = 55
Compute φ(n):
φ(n) = (p-1)(q-1)=40
Choose Public exponent e = 3:
Check gcd(3,40)=1
Compute Private exponent d:
d = 1/3 mod 20 = 7
Message Encryption Decryption
M M2 mod n M3 mod n C2 mod n C6 mod n C 7 mod n
0 0 0 0 0 0
1 1 1 1 1 1
2 4 8 9 14 2
3 9 27 14 49 3
4 16 9 26 31 4
5 25 15 5 15 5
6 36 51 16 26 6
7 39 13 4 9 7
8 9 17 14 49 8
9 26 14 31 36 9
Implementation
Though so far RSA has not been broken but certain attention must be given in
the following cases
Not using small primes.
( because N could be easily factorised)
Not using primes that are very close.
(root of N will reveal how close they are)
Two people must not use the same N.
(if the two public exponents are co-prime, then the message may be retrieved)
Message should not be observable of e th power.
(if the value of e is very small, then it is easy to find m)
Basic idea about IDEA…
Here Plain text is of 64 bit.
Key is of 128 bit. And it is divided in 52 sub keys (how?? Thhat we will see in
next slide.)
Cipher text is also as same as plain text in size that is of 64 bit.
Number of identical rounds are 8 where in each round 6 keys are used.
Like this 48 keys and in last round another 4 keys (6 * 8 = 48 + 4 =52 total) are
being used in both the encryption and decryption process.
Design issue
The design philosophy behind the algorithm is one of “ mixing operation from
different algebraic groups”
Lets take a look which different operations are used.
1) XOR
2) Addition
3) Multiplication
Key generation process
First of all we will see how these 52 keys are generated.
The 128 bit key is divided into 8 sub parts that is 16 bits each.
Then the 128 bit key is cyclically shifted to the left by 25 position, so by doing
this we will have one new 128 bit key.
Now similarly as above it is divided into 8 sub blocks and will be used in next
round.
The same process is performed 9 times ans 56 keys are generated from which
the first 52keys will be used.
So likewise from K1 to K52 keys are generated.
Sequence of operation in one round
1) Multiply P1 and K1
2) Add P2 and second K2
3) Add P3 and third K3
4) Multiply P4 and K4
5) Step 1 ⊕ step 3
6) Step 2 ⊕ step 4
7) Multiply step 5 with K5
Sequence of operation in one round
8) Add result of step 6 and step 7
9) Multiply result of step 8 with K6.
10) Add result of step 7 and step 9.
11) XOR result of steps 1 and step 9.
12) XOR result of steps 3 and step 9.
13) XOR result of steps 2 and step 10.
14) XOR result of steps 4 and step 10.
First of all 64 bit plain text is divided into 4 16-bit parts and they are taken as
an input in first round.
At the end of the first encryption round four 16-bit values are produced which
are used as input to the second encryption round
The process is repeated in each of the subsequent 8 encryption rounds
Note that in 9th round we have to use only 4 key( K49, K50, K51,K52) and have
to perform different operation as guided in previous slide.
Decryption
Detecting eavesdropping
Noise
Error correction
Privacy Amplification
Encryption
KEY DISTRIBUTION
Alice and Bob first agree on two representations for ones and zeroes
One for each basis used, {,} and {, }.
This agreement can be done in public
Define
1= 0=
1= 0=
KEY DISTRIBUTION
Properties of Quantum Information
KEY DISTRIBUTION - BB84
1. Alice sends a sequence of photons to Bob.
Each photon in a state with polarization corresponding to 1 or 0, but
with randomly chosen basis.
2. Bob measures the state of the photons he receives, with each state
measured with respect to randomly chosen basis.
3. Alice and Bob communicates via an open channel. For each
photon, they reveal which basis was used for encoding and
decoding respectively. All photons which has been encoded and
decoded with the same basis are kept, while all those where the
basis don't agree are discarded
ENCRYPTION
Key of same size as the plaintext
Used as a one-time-pad
01011001…01
100110100010… BE binding
algorithm
………………010
110011001011…
……………..110
Biometrically-encrypted key
110011001011…
……………..110
101100101010… BE retrieval
………………000 algorithm
01011001…01
Key retrieved
CRYPTANALYSIS
•A brute force attack involves trying all possible keys until hitting on
the one that results in plaintext.
Ciphertext Only Attack
•In a known plaintext attack (KPA) both the plaintext and matching
ciphertext are available for use in discovering the key
Chosen Plaintext Attack