Secret key cryptography

1,183 views

Published on

cryptography basic

Published in: Education, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,183
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
119
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Secret key cryptography

  1. 1. CLASSICAL ENCRYPTION TECHNIQUES
  2. 2.  With secret key cryptography, a single key isused for both encryption and decryption. the sender uses the key (or some set of rules)to encrypt the plaintext and sends theciphertext to the receiver. The receiver applies the same key (or ruleset)to decrypt the message and recover theplaintext. Because a single key is used for bothfunctions, secret key cryptography is alsocalled symmetric encryption.
  3. 3.  Plaintext: This is the original intelligible messageor data that is fed into the algorithm as input. Encryption algorithm: The encryption algorithmperforms various substitutions andtransformations on the plaintext. Secret key: The secret key is also input to theencryption algorithm. The key is a valueindependent of the plaintext and of thealgorithm. The algorithm will produce a differentoutput depending on the specific key being usedat the time. The exact substitutions andtransformations performed by the algorithmdepend on the key.
  4. 4.  Ciphertext: This is the scrambled messageproduced as output. It depends on theplaintext and the secret key. For a givenmessage, two different keys will produce twodifferent ciphertexts. The ciphertext is anapparently random stream of data and, as itstands, is unintelligible. Decryption algorithm: This is essentially theencryption algorithm run in reverse. It takesthe ciphertext and the secret key andproduces the original plaintext.
  5. 5.  With this form of cryptography, it is obviousthat the key must be known to both thesender and the receiver; that, in fact, is thesecret. The biggest difficulty with thisapproach, of course, is the distribution of thekey.
  6. 6.  two requirements for secure use of symmetricencryption:◦ a strong encryption algorithm◦ a secret key known only to sender / receiver mathematically have:Y = E(K, X)X = D(K, Y) assume encryption algorithm is known implies a secure channel to distribute key
  7. 7.  Secret key cryptography schemes are generallycategorized as being either stream ciphers or block ciphers. Stream ciphers operate on a single bit (byte orcomputer word) at a time and implement someform of feedback mechanism so that the key isconstantly changing. A block cipher is so-called because the schemeencrypts one block of data at a time using thesame key on each block. In general, the sameplaintext block will always encrypt to the sameciphertext when using the same key in a blockcipher whereas the same plaintext will encrypt todifferent ciphertext in a stream cipher.Secret key cryptography schemes
  8. 8.  Stream ciphers come in several flavors buttwo are worth mentioning here. Self-synchronizing stream ciphers calculateeach bit in the keystream as a function of theprevious n bits in the keystream. It is termed "self-synchronizing" because thedecryption process can stay synchronizedwith the encryption process merely byknowing how far into the n-bit keystream itis.
  9. 9.  Block ciphers can operate in one of several modes; the following four are the most important: Electronic Codebook (ECB) mode is the simplest, mostobvious application: the secret key is used to encryptthe plaintext block to form a ciphertext block. Twoidentical plaintext blocks, then, will always generatethe same ciphertext block. Although this is the mostcommon mode of block ciphers, it is susceptible to avariety of brute-force attacks. Cipher Block Chaining (CBC) mode adds a feedbackmechanism to the encryption scheme. In CBC, theplaintext is exclusively-ORed (XORed) with theprevious ciphertext block prior to encryption. In thismode, two identical blocks of plaintext never encryptto the same ciphertext.
  10. 10.  Cipher Feedback (CFB) mode is a block cipher implementationas a self-synchronizing stream cipher. CFB mode allows datato be encrypted in units smaller than the block size, whichmight be useful in some applications such as encryptinginteractive terminal input. If we were using 1-byte CFB mode,for example, each incoming character is placed into a shiftregister the same size as the block, encrypted, and the blocktransmitted. At the receiving side, the ciphertext is decryptedand the extra bits in the block (i.e., everything above andbeyond the one byte) are discarded. Output Feedback (OFB) mode is a block cipherimplementation conceptually similar to a synchronous streamcipher. OFB prevents the same plaintext block fromgenerating the same ciphertext block by using an internalfeedback mechanism that is independent of both theplaintext and ciphertext bitstreams.
  11. 11.  SUBSTITUTION TECHNIQUES:-The two basic building blocks of allencryption techniques are substitution andtransposition.A substitution technique is one in whichthe letters of plaintext are replaced by otherletters or by numbers or symbols. If theplaintext is viewed as a sequence of bits, thensubstitution involves replacing plaintext bitpatterns with ciphertext bit patterns.
  12. 12.  The idea behind Caesar Codes is lettersubstitution. One strategy uses rotation: turnthe inner wheel and then replace the outerletters (plaintext) with those in the innerwheel (ciphertext):plaintext: CAESARciphertext: PNRFNE
  13. 13. Then the algorithm can be expressed as follows. For each plaintext letter ,substitute the ciphertext letter :C = E(3, p) = (p + 3) mod 26A shift may be of any amount, so that the general Caesar algorithm isC = E(k, p) = (p + k) mod 26where takes on a value in the range 1 to 25.The decryption algorithm issimplyp = D(k, C) = (C - k) mod 26
  14. 14.  Note: The ASCII code is not about encryption;its just a standard for numbering characters.The existence of such a numbering meansthat we can do rotation codes numerically,like this: encoded_char = (plaintext_char +rotation_amount) % 128; ASCII is now being supplanted by UNICODE,which is a vastly larger code, designed tohandle all the worlds languages.
  15. 15.  only have 26 possible ciphersA maps to A,B,..Z could simply try each in turn a brute force search given ciphertext, just try all shifts of letters do need to recognize when have plaintext eg. break ciphertext "GCUA VQ DTGCM"
  16. 16.  human languages are redundant eg "th lrd s m shphrd shll nt wnt" letters are not equally commonly used in English E is by far the most commonletterfollowed by T,R,N,I,O,A,S other letters like Z,J,K,Q,X are fairly rare have tables of single, double & triple letterfrequencies for various languages
  17. 17.  given ciphertext:UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZVUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ count relative letter frequencies (see text) guess P & Z are e and t guess ZW is th and hence ZWP is the proceeding with trial and error finally get:it was disclosed yesterday that several informal butdirect contacts have been made with politicalrepresentatives of the viet cong in moscow
  18. 18.  one approach to improving security was toencrypt multiple letters the Playfair Cipher is an example invented by Charles Wheatstone in 1854, butnamed after his friend Baron Playfair The best-known multiple-letter encryptioncipher is the Playfair, which treats digrams inthe plaintext as single units and translatesthese units into ciphertext digrams.
  19. 19.  The Playfair algorithm is based on the use ofa 5 × 5 matrix of letters constructed using akeyword. Example:-
  20. 20.  Keyword – MONARCHY The matrix is constructed by filling in theletters of the keyword (minus duplicates)from left to right and from top to bottom,and then filling in the remainder of the matrixwith the remaining letters in alphabetic order. The letters I and J count as one letter.
  21. 21.  1. Repeating plaintext letters that are in thesame pair are separated with a filler letter,such as x, so that balloon would betreated as ba lx lo on. 2. Two plaintext letters that fall in the samerow of the matrix are each replaced by theletter to the right, with the first element ofthe row circularly following the last.For example, ar is encrypted as RM.
  22. 22.  3. Two plaintext letters that fall in the samecolumn are each replaced by the letterbeneath, with the top element of the columncircularly following the last.For example, mu is encrypted as CM. 4. Otherwise, each plaintext letter in a pair isreplaced by the letter that lies in its own rowand the column occupied by the otherplaintext letter.Thus, hs becomes BP and ea becomes IM(or JM, as the encipherer wishes).
  23. 23.  security much improved overmonoalphabetic since have 26 x 26 = 676 digrams would need a 676 entry frequency table toanalyse (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 hundredletters since still has much of plaintext structure
  24. 24.  simplest polyalphabetic substitution cipher effectively multiple caesar ciphers key is multiple letters long K = k1 k2 ... kd ith letter specifies ith alphabet to use use each alphabet in turn repeat from start after d letters in message decryption simply works in reverse
  25. 25.  write the plaintext out write the keyword repeated above it use each key letter as a caesar cipher key encrypt the corresponding plaintext letter eg using keyword deceptivekey: deceptivedeceptivedeceptiveplaintext: wearediscoveredsaveyourselfciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
  26. 26.  Another interesting multiletter cipher is theHill cipher, developed by the mathematicianLester Hill in 1929.
  27. 27.  Each new message requires a new key of thesame length as the new message. Such ascheme, known as a one-time pad, isunbreakable. It produces random output that bears nostatistical relationship to the plaintext. Because the ciphertext contains noinformation whatsoever about the plaintext,there is simply no way to break the code.
  28. 28.  Suppose that we are using a followingscheme with 27 characters in which thetwenty-seventh character is the spacecharacter, but with a one-time key that is aslong as the message. Consider the ciphertextANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS

×