Unit 1 Introduction
Unit 1 Introduction
Kovilvenni-614 403
UNIT I INTRODUCTION
1. BASICS OF CRYPTOGRAPHY
1. Computer data often travels from one computer to another, leaving the safety of its
2. Once the data is out of hand, people with bad intention could modify or forge your
3. Cryptography can reformat and transform our data, making it safer on its trip between
computers.
• Computer Security - generic name for the collection of tools designed to protect data and
to thwart hackers.
• Network Security - measures to protect data during their transmission over a collection of
interconnected computer.
• Internet Security - measures to protect data during their transmission over a collection of
interconnected networks.
3. Replay involves the passive capture of a data unit and its subsequent retransmission
to produce an unauthorized effect (Figure b).
4. Modification of messages simply means that some portion of a legitimate message is
altered, or that messages are delayed or reordered, to produce an unauthorized effect
6. This attack may have a specific target; for example, an entity may suppress all
messages directed to a particular destination (e.g., the security audit service).
SECURITY SERVICES
The classification of security services are as follows:
1. Confidentiality: Ensures that the information in a computer system and transmitted
information are accessible only for reading by authorized parties. Eg., printing,
displaying and other forms of disclosure.
2. Authentication: Ensures that the origin of a message or electronic document is
correctly identified, with an assurance that the identity is not false.
3. Integrity: Ensures that only authorized parties are able to modify computer system
assets and transmitted information. Modification includes writing, changing status,
deleting, creating and delaying or replaying of transmitted messages.
4. Non repudiation: Requires that neither the sender nor the receiver of a message be
able to deny the transmission.
5. Access control: Requires that access to information resources may be controlled by or
the target system.
6. Availability: Requires that computer system assets be available to authorized parties
when needed.
Security Mechanisms
1. Table lists the security mechanisms defined in X.800. As can be seen the mechanisms
are divided into those that are implemented in a specific protocol layer and those that
are not specific to any particular protocol layer or security service.
1. An original message is known as the plaintext, while the coded message is called the
ciphertext.
2. The process of converting from plaintext to cipher text is known as enciphering or
encryption; restoring the plaintext from the cipher text is deciphering or decryption.
3. The many schemes used for encryption constitute the area of study known as
cryptography. Such a scheme is known as a cryptographic system or a cipher.
Techniques used for deciphering a message without any knowledge of the enciphering
details fall into the area of cryptanalysis.
4. Cryptanalysis is what the layperson calls "breaking the code." The areas of
cryptography and cryptanalysis together are called cryptology.
Substitution Techniques:
1. Caesar Cipher
2. Play fair Cipher
3. Hill Cipher
4. Poly alphabetic Ciphers
1. Caesar Cipher:
The Caesar cipher involves replacing each letter of the alphabet with the letter
standing three places further down the alphabet.
Example:
Plain: meet me after the toga party
Cipher: PHHW PH DIWHU WKH WRJD SDUWB
n o p q r s t u V w x y z
13 14 15 16 17 18 19 20 21 22 23 24 25
Example:
Encipher the plaintext GOD using Hill cipher using the key
SOL: Encryption:
C= E (K, P) = KP mod 26
GOD = 6 14 3
C= = mod 26
=
C= GAX
4. Vigenère Cipher
Simplest polyalphabetic substitution cipher is the Vigenère Cipher
To aid in understanding the scheme and to aid in its use, a matrix known as the
vigenere table is constructed.
Each of the 26 ciphers is laid out horizontally, with key letter for each cipher to its
left.
A normal alphabet for the plaintext runs across the top.
1. Transposition Techniques
All the techniques examine so far involve the substitution of a ciphertext symbol for a
plaintext symbol.
A very different kind of mapping is achieved by performing some sort of permutation
on the plaintext letters. This technique is referred to as a transposition cipher.
Rail Fence cipher
Row Transposition Ciphers
Example:
Key 4 3 1 2 5 6 7
a t t a c k p
Plaintext o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Steganography
An alternative to encryption that hides existence of message.
A simple form of Steganography is one in which an arrangement of words or letters
within an apparently innocuous text spells out the real message.
Various other techniques of Steganography are as follows:
1. Character marking – selected letters of printed or typewritten text are
overwritten in pencil. The marks are ordinarily not visible unless the paper is
held at an angle to bright light.
2. Invisible ink – a number of substances can be used for writing but leave no
visible trace until heat or some chemical is applied to the paper.
3. Pin punctures – small pin punctures on selected letters are ordinarily not
visible unless the paper is held up in front of a light.
4. Typewriter correction ribbon – used between lines typed with a black
ribbon, the results of typing with the correction tape are visible only under a
strong light.
CONVENTIONAL CRYPTOGRAPHY
Data Encryption Standard (DES)
The most widely used encryption scheme is based on the Data Encryption Standard
(DES) adopted in 1977 by the National Bureau of Standards, now the National
Institute of Standards and Technology (NIST), as Federal Information Processing
Standard 46 (FIPS PUB 46).
The algorithm itself is referred to as the Data Encryption Algorithm (DEA).
For DES, data are encrypted in 64-bit blocks using a 56-bit key.
The same steps, with the same key, are used to reverse the encryption.
DES Encryption:
The basic process consists of:
An initial permutation (IP)
16 rounds of a complex key dependent calculation f
A final permutation, being the inverse of IP
DES key schedule: (Operation on key)
The bits are numbered from 1 to 64, every 8 bit is ignored.
64 bit key is used as an input to the algorithm.
Forms sub keys used in each round
Consists of:
Initial permutation of the key (PC1) which selects 56-bits in two 28-bit halves C0
and D0
16 stages consisting of:
At each round, the two halves are separately subjected to circular shift or
rotation of 1 or 2 bits.
These shifted values serve as input to the next round.
They also serve as input to permuted choice 2 (PC2), which produces a 48 bit
output that serves as input to the function F (Ri-1 , Ki )
Inverse IP:
40 8 48 16 56 24 64 32
39 7 47 15 55 23 63 31
38 6 46 14 54 22 62 30
37 5 45 13 53 21 61 29
36 4 44 12 52 20 60 28
35 3 43 11 51 19 59 27
34 2 42 10 50 18 58 26
33 1 41 9 49 17 57 25
Calculation of F(R,K):
DES Decryption:
With Feistel design, decryption uses the same algorithm as encryption, except that the
application of sub keys is reversed (SK16 … SK1)
AES Round
RSA Algorithm:
Introduced by Rivest, Shamir & Adleman of MIT in 1977
Best used public-key scheme
It is a block cipher in which plaintext and ciphertext are integers between 0 to n-1 for
some n.
Typical size of n is 1024
RSA makes use of expressions with exponentials
Security due to cost of factoring large numbers
Factorization takes o(e log n log log n) operations (hard)
RSA algorithm:
The ingredients of RSA algorithm are as follows:
1. p, q, two prime numbers private, chosen
2. n= pq public, calculated
3. e, with gcd (e , ø(n))=1 , Where 1<e<ø(n) public, chosen
4. d ≡ e-1 mod ø(n) private, calculated
RSA Key generation:
Each user generates a public/private key pair by:
1. Select p , q p and q are prime numbers , p is not equal to q
2. Calculate n = p * q
3. Calculate ø(n)=(p-1)(q-1)
4. Select integer e
gcd (e , ø(n))=1 , Where 1<e<ø(n)
5. Calculate d
d ≡ e-1 mod ø(n)
6. Public key: PU={e , n}
7. Private key: PR={d , n}
RSA Encryption and decryption:
Encryption:
Plaintext: M<n
Ciphertext: C=Me mod N
Decryption:
Ciphertext: C
3.HASH FUNCTION
Figure c
Only the hash code is encrypted, using public-key encryption and using the sender's
private key. This provides authentication.
It also provides a digital signature, because only the sender could have produced the
encrypted hash code.
Figure d
If confidentiality as well as a digital signature is desired, then the message plus the
private-key-encrypted hash code can be encrypted using a symmetric secret key.
Figure e
It is possible to use a hash function but no encryption for message authentication.
The technique assumes that the two communicating parties share a common secret
value S.
A computes the hash value over the concatenation of M and S and appends the
resulting hash value to M.
Because B possesses S, it can re compute the hash value to verify.
Because the secret value itself is not sent, an opponent cannot modify an intercepted
message and cannot generate a false message.
Figure f
Confidentiality can be added to the approach of (e) by encrypting the entire message
plus the hash code.
= XOR operation
SHA-512 logic
The algorithm takes as input a message with a maximum length of less than 2 128 bits
and produces as output a 512-bit message digest. The input is processed in 1024-bit blocks.
Steps
1. Append padding bits: The message is padded so that is length is congruent to 896
modulo 1024. Padding consists of a single 1-bit followed by the necessary number of
0-bits.
2. Append length: A block of 128 bits is appended to the message. This block is treated
as an unsigned 128-bit integer that contains the length of the original message(before
the
3. Initialize has buffer: A 512-bits buffer is used to hold intermediate and final results
of the hash function. The buffer can be represented as eight64-bit registers
(a,b,c,d,e,f,g,h). these registers are initialize to the following 64-bit integers
(hexadecimal values).
Sr.No Register Values
1. a 6A09E667F3BCC908
2. b BB67AE8584CAA73B
3. c 3C6EF372FE94F82B
4. d A54FF53A5F1D36F1
abcdefghi=The output of the last round of processing of the ith message block.
T2=(⅀5120 a)+Maj(a,b,c)
a=T1+T2
b=a
c=b
d=c
f=e
g=f
h=g
3. For example, suppose that John sends an authenticated message to Mary, using one of the
schemes of Figure 13.1. Consider the following disputes that could arise.
1. Mary may forge a different message and claim that it came from John. Mary would
simply have to create a message and append an authentication code using the key that
John and Mary share.
2. John can deny sending the message. Because it is possible for Mary to forge a message,
there is no way to prove that John did in fact send the message.
4. Both scenarios are of legitimate concern. Here is an example of the first scenario: An
electronic funds transfer takes place, and the receiver increases the amount of funds transferred
and claims that the larger amount had arrived from the sender.An example of the second
scenario is that an electronic mail message contains instructions to a stockbroker for a
transaction that subsequently turns out badly.The sender pretends that the message was never
sent.
DSS Approach:
DSS uses an algorithm that is designed to provide only the digital signature function. Unlike
RSA, it cannot be used for encryption or key exchange.
In RSA approach, the message to be signed is input to a hash function that produces a secure
hash code of fixed length.
This hash code is then encrypted using the sender's private key to form the signature. Both the
message and the signature are then transmitted.
The recipient takes the message and produces a hash code.
The recipient also decrypts the signature using the sender's public key.
If the calculated hash code matches the decrypted signature, the signature is accepted as valid.
In the sender end, DSS approach also makes use of a hash function.
The hash code is provided as input to a signature function along with a random
number k generated for this particular signature.
The signature function also depends on the sender's private key PRa and a set of parameters
known to a group of communicating principals.
We can consider this set to constitute a global public key PUG.
The result is a signature consisting of two components, labeled s and r.
At the receiving end, the hash code of the incoming message is generated.
This plus the signature is input to a verification function.
The verification function also depends on the global public key as well as the sender's public
key PUa .
The output of the verification function is a value that is equal to the signature component r if
the signature is valid.
Digital Signature Algorithm:
DSA is based on the difficulty of computing discrete logarithms
There are three parameters that are public and can be common to a group of users.
A 160-bit prime number q is chosen.
Next, a prime number p is selected with a length between 512 and 1024 bits such that q divides
(p-1).
Finally, g is chosen to be of the form h( p -1)/q mod p, where h is an integer between 1 and (p -1)
with the restriction that g must be greater than 1.
p prime number where 2 L- 1 < p < 2 L, for 512 L 1024& L a multiple of 64.
q prime divisor of (p-1), where 2 159 < q < 2 160 ; i.e., bit length of 160 bits
y = g x mod p
Signing
r = ( g k mod p ) mod q
s = [ k -1 (H(M) + xr )] mod q
Signature = (r, s)
Verifying
w = (s') -1 mod q
u2 =(r') w mod q
TEST : v = r'
M = message to be signed