Uploaded by abhakiran.rajpoot

cryptography

advertisement
CRYPTOGRAPHY
1
Cryptography
2
3
TERMINOLOGY
Plain Text:- The message or data that is to be
transmitted over the network.
 Cipher :- A mapping algorithm which is used to encrypt
or decrypt the message.
 Key : A key is a number (or a set of numbers) that the
cipher implements to encrypt or decrypt a message.

To encrypt a message we need to convert the plaintext to
ciphertext using an encryption algorithm and encryption
key whereas to decrypt the message we require a
decryption algorithm and a decryption key to reveal the
plaintext
4
Symmetric Key Cryptography
System
5
ASYMMETRIC KEY
6
TYPES OF CIPHERS
7

Substitution
Replace a character by some other
character while encryption. For
example (plaintext  ABCD) and
(ciphertext  QWER).

Transpositions
Change the position of the character
rather than changing the character
while
encryption.
For
example
(plaintext  ABCD) and (ciphertext 
DBAC).
8
Stream Cipher
A stream cipher is a symmetric key
cipher where plaintext digits are
combined with a pseudorandom cipher
digit stream (key stream).
 In a stream cipher each plaintext digit is
encrypted one at a time with the
corresponding digit of the key stream, to
give a digit of the cipher text stream.
 Example:-- RC4, SEAL

9
Example
Plaintext
Key
DEAD
BEEF

Ciphertext
0110 0000 0100 0010 =6042
Ciphertext
Key
Plaintext
1101 1110 1010 1101
1011 1110 1110 1111
6042
BEEF
0110 0000 0100 0010
 1011 1110 1110 1111
1101 1110 1010 1101 = DEAD
10
Symmetric Algorithm (Block
Cipher)
Block ciphers use a block of bits as the unit of
encryption and decryption.
 The mapping is one to one.
 Two operations are involved Substitution and
Permutation.
 Both operations are performed on block bits to
create a key to produce another block of bits.
 In
the decryption process, operations are
performed in the reverse order based on same key
to retrieve original message.
 Example: DES, AES, IDEA

11
DES (BLOCK CIPHER)

The encryption process is made of two
permutations (P-boxes), which we call
initial and final permutations, and sixteen
Feistel rounds.
12
General Structure of DES
13
Rounds in DES
14
Public Key Cryptography (RSA)
Given by Rivest, Shamir & Adleman of MIT in 1977
best known & widely used public-key scheme
based on exponentiation in a finite field over integers
modulo a prime
uses large integers (eg. 1024 bits)
security due to cost of factoring large numbers
15
RSA: Creating public/private key
pair





Choose two large prime numbers p, q. (e.g.,
1024 bits each)
Compute n = pq, z = (p-1)(q-1)
Choose e (with e<n) that has no common
factors with z. (e, z are “relatively prime”).
Choose d such that ed-1 is exactly divisible
by z. (in other words: ed mod z = 1 ).
Public key is (n,e). Private key is (n,d).
16
RSA: Encryption, decryption
Given (n,e) and (n,d) as computed above
 To encrypt message m (<n), compute

c = m e mod n

To decrypt received bit pattern, c,
compute
m = c d mod n
17
RSA example:
Bob chooses p=5, q=7. Then n=35, z=24.
e=5 (so e, z relatively prime).
d=29 (so ed-1 exactly divisible by z).
Encrypting messages.
encrypt:
c
decrypt:
17
c
m
me
12
24832
c = me mod n
d
481968572106750915091411825223071697
18
17
m = cd mod n
12
Download