Upload
ankituiet
View
217
Download
0
Embed Size (px)
Citation preview
8/14/2019 A Study of Cryptography
1/34
A Study ofA Study of
CryptographyCryptography
Submitted BySubmitted By
Vartika Bajpai (26057)Vartika Bajpai (26057)
Brijesh Kumar Gupta(26058)Brijesh Kumar Gupta(26058)
Ankit Srivastava (26402)Ankit Srivastava (26402)
8/14/2019 A Study of Cryptography
2/34
CryptographyCryptography
Cryptography is the science of protecting data, which provides means and methods ofCryptography is the science of protecting data, which provides means and methods of
converting data into unreadable form , so thatconverting data into unreadable form , so that
The data cannot be accessed for unauthorized use.The data cannot be accessed for unauthorized use.
The content of the data frames is hidden.The content of the data frames is hidden.
The authenticity of the data can be established.The authenticity of the data can be established.
The undetected modification of the data is avoided.The undetected modification of the data is avoided.
The data cannot be disowned by the originator of the message.The data cannot be disowned by the originator of the message.
Cryptography is especially useful in the cases of financial and personalCryptography is especially useful in the cases of financial and personal
data, irrespective of the fact that the data is being transmitted over a mediumdata, irrespective of the fact that the data is being transmitted over a medium
or is stored on a storage device. It provides a powerful means of verifyingor is stored on a storage device. It provides a powerful means of verifying
the authenticity of data and identifying the culprit, if the confidentiality andthe authenticity of data and identifying the culprit, if the confidentiality and
integrity of the data is violated.integrity of the data is violated.
8/14/2019 A Study of Cryptography
3/34
Terms Related toTerms Related to
CryptographyCryptography
Plain Text :The message that has to be transmitted to theThe message that has to be transmitted to therecipient .recipient .
Encryption :The process of changing the content of aThe process of changing the content of amessage in amessage in a
manner such that it hides the actual message.manner such that it hides the actual message.
Cipher Text:The output that is generated after encryptingThe output that is generated after encryptingthe plain text.the plain text.
Decryption :The reverse of encryption and is the process ofThe reverse of encryption and is the process ofretrieving the original message from its encrypted form. Thisretrieving the original message from its encrypted form. Thisprocess converts ciphertext to plaintext.process converts ciphertext to plaintext.
Key :Is a word, number, or phrase that is used to encrypt theIs a word, number, or phrase that is used to encrypt thecleartext.cleartext.
8/14/2019 A Study of Cryptography
4/34
Cryptography FundamentalsCryptography Fundamentals
Cryptography Privacy :Cryptography Privacy :
Cryptography Authentication :Cryptography Authentication :
8/14/2019 A Study of Cryptography
5/34
Types of CiphersTypes of Ciphers
Substitution Cipher :In this cipher , each letter or a group ofIn this cipher , each letter or a group ofletters is replaced by another letter or group of letters.letters is replaced by another letter or group of letters.
These are of two types-These are of two types- Monoalphabetic Cipher : In this cipher , character in theIn this cipher , character in the
plain text is always changed to the same character in theplain text is always changed to the same character in the
cipher text regardless of the position in the text.cipher text regardless of the position in the text.-For Example:-For Example:
Plaintext : H E L L OH E L L O
Ciphertext : K H O O RK H O O R Polyalphabetic Cipher : In this cipher , each occurrence ofIn this cipher , each occurrence of
a character can have a different substitute.a character can have a different substitute.
-For Example:-For Example:
Plaintext : H E L L OH E L L O
Ciphertext : A B N Z FA B N Z F
8/14/2019 A Study of Cryptography
6/34
Transposition Cipher :Transposition Cipher : In this cipher, there is noIn this cipher, there is no
substitution of the characters instead their locations change.substitution of the characters instead their locations change.
In other words , it reorders the symbol in a block of symbols.In other words , it reorders the symbol in a block of symbols.
- For Example : The MEGABUCK is the key.- For Example : The MEGABUCK is the key.
Plaintext : please transfer one million dollar to.M E G A B U C KM E G A B U C K
7 4 5 1 2 8 3 67 4 5 1 2 8 3 6
p l e a s e t rp l e a s e t r
a n s f e r o na n s f e r o n
e m i l l i o ne m i l l i o n
d o l l a r t od o l l a r t o
Ciphertext : afllselatootlnmoesilrnnopaederir
8/14/2019 A Study of Cryptography
7/34
Cryptographic TechniquesCryptographic Techniques
Two types of Cryptographic Techniques :Two types of Cryptographic Techniques :
Single Key CryptographySingle Key Cryptography
Public Key CryptographyPublic Key Cryptography
8/14/2019 A Study of Cryptography
8/34
Comparison of Symmetric andComparison of Symmetric and
Asymmetric EncryptionAsymmetric Encryption
Encryption DecryptionCiphertext
Original
PlaintextPlaintext
Secret Key
Symmetric (Single Key) CryptographySymmetric (Single Key) Cryptography
Encryption DecryptionCiphertext
Original
Plaintext
Private KeyPublic Key
Plaintext
Asymmetric (Two Key) CryptographyAsymmetric (Two Key) Cryptography
8/14/2019 A Study of Cryptography
9/34
Single Key CryptographySingle Key Cryptography
The process of encryption and decryption of information by using aThe process of encryption and decryption of information by using a
single key is known as secret key cryptography orsingle key is known as secret key cryptography or symmetric keysymmetric key
cryptographycryptography..
In symmetric key cryptography, the same key is used to encrypt asIn symmetric key cryptography, the same key is used to encrypt as
well as decrypt the data. The main problem with symmetric keywell as decrypt the data. The main problem with symmetric key
algorithms is that the sender and the receiver have to agree on aalgorithms is that the sender and the receiver have to agree on acommon key.common key.
A secure channel is also required between the sender and theA secure channel is also required between the sender and the
receiver have to exchange the secret key.receiver have to exchange the secret key.
Symmetric key Algorithm :Symmetric key Algorithm :The algorithm takes an n-bitThe algorithm takes an n-bit
block of plaintext as input n transform it using the key into n-block of plaintext as input n transform it using the key into n-
bit block of cipher text .bit block of cipher text .
Two types of symmetric key algorithm:Two types of symmetric key algorithm:
Data Encryption Standard (DES)Data Encryption Standard (DES)
Triple Data Encryption Standard (3-DES)Triple Data Encryption Standard (3-DES)
8/14/2019 A Study of Cryptography
10/34
Data Encryption StandardData Encryption Standard
DES was developed as a standard for communications andDES was developed as a standard for communications anddata protection by an IBM research team, in response to adata protection by an IBM research team, in response to apublic request for proposals by the NBS - the National Bureaupublic request for proposals by the NBS - the National Bureauof Standards (which is now known as NIST).of Standards (which is now known as NIST).
8/14/2019 A Study of Cryptography
11/34
The S-P NetworkThe S-P Network
P-BoxP-Box ::A permutationA permutationbox for bits parallels thebox for bits parallels the
traditional transpositiontraditional transposition
cipher for characters. Itcipher for characters. It
performs a transposition atperforms a transposition atthe bit level.the bit level.
S-BoxS-Box :: A SubstitutionA Substitutionbox parallels the traditionalbox parallels the traditional
substitution cipher forsubstitution cipher for
characters.characters.
P-box
Decod
er
:3to
S-box
Enco
der
:8to
8/14/2019 A Study of Cryptography
12/34
DES : OverviewDES : Overview
It takes 64 bits inputIt takes 64 bits input
at a time gives 64 bitat a time gives 64 bit
outputoutput
Initial permutationInitial permutation
rearranges 64 bits (norearranges 64 bits (no
cryptographic effect)cryptographic effect)
Encoding is in 16Encoding is in 16
roundsrounds
plaintext
INITIAL PERMUTATION
ROUND 1
ROUND 2
ROUND 16
INITIAL PERMUTATION-1
...
ciphertext
8/14/2019 A Study of Cryptography
13/34
DES : Encryption RoundDES : Encryption Round
64 bits divided into64 bits divided into
left, right halves.left, right halves.
Right half goesRight half goes
through function f,through function f,
mixed with key.mixed with key.
Right half added toRight half added to
left half.left half.
Halves swappedHalves swapped
(except in last round)(except in last round)
Li-1 Ri-1
Li Ri
f
8/14/2019 A Study of Cryptography
14/34
DES FunctionDES Function
Expand right side fromExpand right side from
32 to 48 bits (some32 to 48 bits (some
get reused)get reused)
Add 48 bits of keyAdd 48 bits of key
(chosen by schedule)(chosen by schedule)
S-boxes: each set of 6S-boxes: each set of 6
bits reduced to 4bits reduced to 4
P-box permutes 32P-box permutes 32
bitsbits
Ri-1
Expansion
Ki
Eight S-boxes
P-box
Output
8/14/2019 A Study of Cryptography
15/34
DES :Decryption RoundDES :Decryption Round
Equations for round i:Equations for round i:
In other words:In other words:
So decryption is theSo decryption is thesame as encryptionsame as encryption
Last round, no swap:Last round, no swap:really is the samereally is the same
Li=R
i1
Ri = Li 1 f Ri 1( )
Ri 1 = Li
Li 1 = Ri f Li( )
Li-1 Ri-1
Li Ri
f
8/14/2019 A Study of Cryptography
16/34
Insecurity In DESInsecurity In DES
The key in DES is too short that it can be broken intoThe key in DES is too short that it can be broken into
2^n time if it has n bit of key.2^n time if it has n bit of key.
Why not 2-DES?Why not 2-DES?
Then to improve the security of the block cipherThen to improve the security of the block cipher
, two independent keys are used to encrypt the data, two independent keys are used to encrypt the datathinking that this would square the security of the data butthinking that this would square the security of the data but
this will take only double the time to break the singlethis will take only double the time to break the single
encryption scheme and causingencryption scheme and causing MEET In The MIDDLEMEET In The MIDDLE attackattack
8/14/2019 A Study of Cryptography
17/34
Triple Data EncryptionTriple Data Encryption
StandardStandard Critics of DES contend that the key is too short.Critics of DES contend that the key is too short.
To increase the length of key Triple DES has been proposed andTo increase the length of key Triple DES has been proposed and
implemented.implemented.
This uses 3 DES blocksThis uses 3 DES blocks
-The encrypting block uses an-The encrypting block uses an Encryption Decryption Encryption Decryption
EncryptionEncryptioncombination of DESs.combination of DESs.
-- 3-DES encrypts 64 bit block I into 64 bit block O.-- 3-DES encrypts 64 bit block I into 64 bit block O.
O=EO=Ek3k3 (D(Dk2k2 (E(Ek1k1 (I)))(I)))
-The decrypting block uses an-The decrypting block uses an Decryption Encryption Decryption Encryption
DecryptionDecryptioncombination of DESs.combination of DESs.
-- 3-DES encrypts 64 bit block I into 64 bit block O.-- 3-DES encrypts 64 bit block I into 64 bit block O.
O=DO=Dk1k1 (E(Ek2k2 (D(Dk3k3 (I)))(I)))
8/14/2019 A Study of Cryptography
18/34
Encryption/DecryptionEncryption/Decryption
Triple DES ModelTriple DES Model
8/14/2019 A Study of Cryptography
19/34
3 DES : Keying Option3 DES : Keying Option
The standards define three keying options:The standards define three keying options: Keying option 1: All three keys are independent.Keying option 1: All three keys are independent.
Keying option 1 is the strongest, with 3 x 56 = 168Keying option 1 is the strongest, with 3 x 56 = 168independent key bits.independent key bits.
Keying option 2: K1 and K2 are independent, and K3 = K1.Keying option 2: K1 and K2 are independent, and K3 = K1.
Keying option 2 provides less security, with 2 x 56 =Keying option 2 provides less security, with 2 x 56 =112 key bits. This option is stronger than simply DES112 key bits. This option is stronger than simply DESencrypting twice, e.g. with K1 and K2, because itencrypting twice, e.g. with K1 and K2, because itprotects againstprotects against MEET IN THE MIDDLEMEET IN THE MIDDLE attack.attack.
Keying option 3: All three keys are identical, i.e. K1 = K2 =Keying option 3: All three keys are identical, i.e. K1 = K2 =K3.K3.
Keying option 3 is no better than DES, with only 56Keying option 3 is no better than DES, with only 56key bits. This option provides backward compatibilitykey bits. This option provides backward compatibilitywith DES, because the first and second DESwith DES, because the first and second DESoperations simply cancel out.operations simply cancel out.
8/14/2019 A Study of Cryptography
20/34
Public Key CryptographyPublic Key Cryptography
Public key cryptography is that the key used to encrypt a message isPublic key cryptography is that the key used to encrypt a message isnot the same as the key used to decrypt it. Each user has a pair ofnot the same as the key used to decrypt it. Each user has a pair ofcryptographic keys acryptographic keys a public keykey and aand a private key. The private key. The private keyis kept secret, whilst the public key may be widely distributed.is kept secret, whilst the public key may be widely distributed.
In public key cryptography, the data that is encrypted with the publicIn public key cryptography, the data that is encrypted with the publickey can only be decrypted with the corresponding private key and vicekey can only be decrypted with the corresponding private key and vice
versa. Due to this asymmetry public key cryptography is known asversa. Due to this asymmetry public key cryptography is known asasymmetric cryptographyasymmetric cryptography..
The public key cryptography solves one of the most vexing problems ofThe public key cryptography solves one of the most vexing problems ofall prior cryptographyall prior cryptography the necessity of establishing a securechannel for the exchange of the key.
For example:-
An analogy to Public Key Encryption is that of a locked mailbox andmail slot. Mailslot is accessible to public but mailbox can be opened byone who has the Key to it.
8/14/2019 A Study of Cryptography
21/34
Public Key Algorithm
The Encryption algorithm, E and the decryptionThe Encryption algorithm, E and the decryption
algorithm, D has to meet three requirements which are asalgorithm, D has to meet three requirements which are as
follows :follows :
D(E(P))=P;D(E(P))=P;
It is exceedingly difficult to deduce D from E;It is exceedingly difficult to deduce D from E; E cannot be broken by a chosen plaintext attack..E cannot be broken by a chosen plaintext attack..
One of the most widely used Public key algorithm isOne of the most widely used Public key algorithm is
RSA..
8/14/2019 A Study of Cryptography
22/34
RSARSA
In cryptography , RSA( which stands for Rivest, Shamir and Adleman whoIn cryptography , RSA( which stands for Rivest, Shamir and Adleman who
first publicly described it ) is an algorithm for public key cryptography.first publicly described it ) is an algorithm for public key cryptography.
RSA can be summarized in the following steps:RSA can be summarized in the following steps:
1.1. Choose 2 distinct prime numbers p and q.Choose 2 distinct prime numbers p and q.
- For security purposes, the integers p and q should be chosen- For security purposes, the integers p and q should be chosen
uniformly at random and should be of similar bit-length.uniformly at random and should be of similar bit-length.
2.2. Compute n= p*q and z= (p-1)*(q-1)Compute n= p*q and z= (p-1)*(q-1)
3.3. Choose a number relative prime to z and name it as d.Choose a number relative prime to z and name it as d.
4.4. Find e such that e*d=1 mod z.Find e such that e*d=1 mod z.
Thus inorder toThus inorder to encryptencrypt a message P, computea message P, compute C=PC=P ee mod nmod n..
and toand to decryptdecrypt C,computeC,compute P=CP=Cdd
mod n.mod n.
TheThe Public KeyPublic Key consists of pairconsists of pair (e,n)(e,n) and theand the Private KeyPrivate Key consists ofconsists of(d,n)(d,n)..
8/14/2019 A Study of Cryptography
23/34
RSA ExampleRSA Example
Let we have to encrypt Plain text SUZANNE , as perLet we have to encrypt Plain text SUZANNE , as peralgorithm there will be following steps :algorithm there will be following steps :
1.1. Let p=3 and q=11Let p=3 and q=11
2.2. n=3*11=33 and z=2*10=20n=3*11=33 and z=2*10=20
3.3. a suitable number which is relative prime to 20 isa suitable number which is relative prime to 20 is7,which is d7,which is d
4.4. e can be found by solving equation 7e=1(mode can be found by solving equation 7e=1(mod20),which yields 3.20),which yields 3.
Thus cipher text C=PThus cipher text C=P33mod 33 and after decryption P=Cmod 33 and after decryption P=C77mod33.mod33.
8/14/2019 A Study of Cryptography
24/34
Symbolic
Numeric
P3 P3(mod33)
C7 C7(mod 33)
Symbolic
S 19 6859 28 13492928512
19 S
U 21 9261 21 1801088541
21 U
Z 26 17576 20 1280000000
26 Z
A 01 1 1 1 01 AN 14 5 5 78125 14 N
N 14 5 5 78125 14 N
E 05 26 26 803180176 05 E
8/14/2019 A Study of Cryptography
25/34
RSA ISSUESRSA ISSUES
RSA is computationally intense.RSA is computationally intense.
Commonly used key lengths are 512 bits.Commonly used key lengths are 512 bits.
The plain text should be smaller than the key length.The plain text should be smaller than the key length.
The encrypted text is same size as the key length.The encrypted text is same size as the key length.
Generally used to encrypt secret keys.Generally used to encrypt secret keys. Basis: Factoring a big number is hard.Basis: Factoring a big number is hard.
8/14/2019 A Study of Cryptography
26/34
Digital SignatureDigital Signature
A digital signature or digital signature scheme is aA digital signature or digital signature scheme is a
mathematical scheme for demonstrating the authenticity ofmathematical scheme for demonstrating the authenticity of
a digital message or document. A valid digital signaturea digital message or document. A valid digital signature
gives a recipient reason to believe that the message wasgives a recipient reason to believe that the message was
created by a known sender, and that it was not altered increated by a known sender, and that it was not altered in
transit.transit.
Why Digital Signature is Used?Why Digital Signature is Used?
To provideTo provide authenticity ,integrity and non repudiationauthenticity ,integrity and non repudiation
to electronic documents.to electronic documents.To useTo use Internet as the safe and secure mediumInternet as the safe and secure medium for e-for e-
commerce.commerce.
8/14/2019 A Study of Cryptography
27/34
Continued.Continued.
One possible method for creating a digital signature is forOne possible method for creating a digital signature is forthe originator of data to create the signature by encryptingthe originator of data to create the signature by encryptingall of the data with the originator's private key and enclosingall of the data with the originator's private key and enclosingthe signature with the original data.the signature with the original data.
Anyone with the originator's public key can decrypt theAnyone with the originator's public key can decrypt thesignature and compare the decrypted message to thesignature and compare the decrypted message to theoriginal message. Because only someone with the privateoriginal message. Because only someone with the privatekey can create the signature, the integrity of the message iskey can create the signature, the integrity of the message isverified when the decrypted message matches the original.verified when the decrypted message matches the original.
If an intruder alters the original message during transit, theIf an intruder alters the original message during transit, the
intruder cannot also create a new valid signature. If anintruder cannot also create a new valid signature. If anintruder alters the signature during transit, the signatureintruder alters the signature during transit, the signaturedoes not verify properly and is invalid.does not verify properly and is invalid.
8/14/2019 A Study of Cryptography
28/34
8/14/2019 A Study of Cryptography
29/34
However,However,encrypting all data to provide a digital signature isencrypting all data to provide a digital signature isimpractical for three reasons:impractical for three reasons:
The ciphertext signature is the same size as the correspondingThe ciphertext signature is the same size as the correspondingplaintext, soplaintext, so message sizes are doubledmessage sizes are doubled,, consuming largeconsuming largeamounts of bandwidth and storage space.amounts of bandwidth and storage space.
Public key encryption is slow and places heavy computationalPublic key encryption is slow and places heavy computationalloads on computer processors, so network andloads on computer processors, so network and computercomputerperformance can be significantly degraded.performance can be significantly degraded.
Encrypting the entire contents of information produces largeEncrypting the entire contents of information produces large
amounts of ciphertext, which can be used for cryptanalysisamounts of ciphertext, which can be used for cryptanalysisattacks, especially knownattacks, especially known plaintext attacksplaintext attacks (where certain(where certainparts of the encrypted data, such as e-mail headers, areparts of the encrypted data, such as e-mail headers, areknown beforehand to the attacker).known beforehand to the attacker).
8/14/2019 A Study of Cryptography
30/34
Digital Signature AlgorithmsDigital Signature Algorithms
Digital signature algorithms use more efficient methods toDigital signature algorithms use more efficient methods tocreate digital signatures. The most common types ofcreate digital signatures. The most common types ofdigitaldigitalsignatures today are created by signing message digestssignatures today are created by signing message digestswith the originator's private keywith the originator's private key to create a digitalto create a digitalthumbprint of the data.thumbprint of the data.
Because onlyBecause only the message digest is signed, the signature isthe message digest is signed, the signature isusually much shorter than the data that was signedusually much shorter than the data that was signed..
Therefore, digital signatures place a relatively low load onTherefore, digital signatures place a relatively low load oncomputer processors during the signing process, consumecomputer processors during the signing process, consumeinsignificant amounts of bandwidth, and produce smallinsignificant amounts of bandwidth, and produce smallamounts of ciphertext for cryptanalysis.amounts of ciphertext for cryptanalysis.
Two of the most widely used digital signature algorithmsTwo of the most widely used digital signature algorithmstoday are the RSA digital signature process and the Digitaltoday are the RSA digital signature process and the DigitalSignature Standard (DSS).Signature Standard (DSS).
8/14/2019 A Study of Cryptography
31/34
RSA Digital Signature ProcessRSA Digital Signature Process
In the RSA digital signature process, the private key isIn the RSA digital signature process, the private key isused to encrypt only the message digest. The encryptedused to encrypt only the message digest. The encryptedmessage digest becomes the digital signature and ismessage digest becomes the digital signature and isattached to the original data.attached to the original data.
Digital signing :Digital signing : Sender A does the following:-Sender A does the following:- Creates a message digest of the information to beCreates a message digest of the information to be
sent.sent. Uses her private key (n, d) to compute the signatureUses her private key (n, d) to compute the signature
s=m^d mod n.s=m^d mod n.
Sends this signature s to the recipient, B.Sends this signature s to the recipient, B.
8/14/2019 A Study of Cryptography
32/34
Signature verification:Signature verification:
Recipient B does the following:-Recipient B does the following:-
Uses sender A's public key (n, e) to compute integer v =Uses sender A's public key (n, e) to compute integer v =
s^e mod n.s^e mod n.
Extracts the message digest from this integer.Extracts the message digest from this integer. Independently computes the message digest of theIndependently computes the message digest of the
information that has been signed.information that has been signed.
If both message digests are identical, the signature is valid.If both message digests are identical, the signature is valid.
8/14/2019 A Study of Cryptography
33/34
RSA Digital Signature ProcessRSA Digital Signature Process
8/14/2019 A Study of Cryptography
34/34
Digital signature : ApplicationDigital signature : Application
The Private key isThe Private key isgenerated in the cryptogenerated in the cryptomodule residing in themodule residing in thesmart card.smart card.
The key is kept in theThe key is kept in thememory of the smart card.memory of the smart card.
The key is highly securedThe key is highly securedas it doesnt leave theas it doesnt leave thecard, the message digest iscard, the message digest issent inside the card forsent inside the card forsigning, and the signaturessigning, and the signaturesleave the card.leave the card.
The card gives mobility toThe card gives mobility tothe key and signing can bethe key and signing can bedone on any system.done on any system.(Having smart card reader)(Having smart card reader)