home *** CD-ROM | disk | FTP | other *** search
/ Hacker Chronicles 2 (Alt) / The_Hacker_Chronicles_Volume_II-CD2.iso / crypt / part05 < prev    next >
Encoding:
Text File  |  1995-01-03  |  20.5 KB  |  449 lines

  1.  
  2. Archive-name: cryptography-faq/part05
  3.  
  4.  
  5. This is the fifth of ten parts of the sci.crypt FAQ. The parts are
  6. mostly independent, but you should read the first part before the rest.
  7. We don't have the time to send out missing parts by mail, so don't ask.
  8. Notes such as ``[KAH67]'' refer to the reference list in the last part.
  9.  
  10.  
  11.  
  12. Contents:
  13.  
  14. 5.1. What is a product cipher?
  15. 5.2. What makes a product cipher secure?
  16. 5.3. What are some group-theoretic properties of product ciphers?
  17. 5.4. What can be proven about the security of a product cipher?
  18. 5.5. How are block ciphers used to encrypt data longer than the block size?
  19. 5.6. Can symmetric block ciphers be used for message authentication?
  20. 5.7. What exactly is DES?
  21. 5.8. What is triple DES?
  22. 5.9. What is differential cryptanalysis?
  23. 5.10. How was NSA involved in the design of DES?
  24. 5.11. Is DES available in software?
  25. 5.12. Is DES available in hardware?
  26. 5.13. Can DES be used to protect classified information?
  27. 5.14. What are ECB, CBC, CFB, OFB, and PCBC encryption?
  28.  
  29.  
  30. 5.1. What is a product cipher?
  31.  
  32.   A product cipher is a block cipher that iterates several weak
  33.   operations such as substitution, transposition, modular
  34.   addition/multiplication, and linear transformation. (A ``block
  35.   cipher'' just means a cipher that encrypts a block of data---8 bytes,
  36.   say---all at once, then goes on to the next block.) The notion of
  37.   product ciphers is due to Shannon [SHA49]. Examples of modern
  38.   product ciphers include LUCIFER [SOR84], DES [NBS77], SP-networks
  39.   [KAM78], LOKI [BRO90], FEAL [SHI84], PES [LAI90], Khufu and Khafre
  40.   [ME91a]. The so-called Feistel ciphers are a class of product
  41.   ciphers which operate on one half of the ciphertext at each round,
  42.   and then swap the ciphertext halves after each round. LUCIFER,
  43.   DES, LOKI, and FEAL are examples of Feistel ciphers.
  44.  
  45.   The following table compares the main parameters of several product 
  46.   ciphers:
  47.  
  48.   cipher   |   block length   |   key bits   |   number of rounds
  49.   LUCIFER          128               128                16
  50.   DES               64                56                16
  51.   LOKI              64                64                16
  52.   FEAL              64               128            2^x, x >= 5
  53.   PES               64               128                 8
  54.  
  55. 5.2. What makes a product cipher secure?
  56.  
  57.   Nobody knows how to prove mathematically that a product cipher is
  58.   completely secure. So in practice one begins by demonstrating that the
  59.   cipher ``looks highly random''. For example, the cipher must be
  60.   nonlinear, and it must produce ciphertext which functionally depends
  61.   on every bit of the plaintext and the key. Meyer [MEY78] has shown
  62.   that at least 5 rounds of DES are required to guarantee such a
  63.   dependence. In this sense a product cipher should act as a ``mixing''
  64.   function which combines the plaintext, key, and ciphertext in a
  65.   complex nonlinear fashion.
  66.  
  67.   The fixed per-round substitutions of the product cipher are
  68.   referred to as S-boxes. For example, LUCIFER has 2 S-boxes, and DES
  69.   has 8 S-boxes. The nonlinearity of a product cipher reduces to a
  70.   careful design of these S-boxes. A list of partial design criteria
  71.   for the S-boxes of DES, which apply to S-boxes in general, may be
  72.   found in Brown [BRO89] and Brickell et al. [BRI86].
  73.  
  74. 5.3. What are some group-theoretic properties of product ciphers?
  75.  
  76.   Let E be a product cipher that maps N-bit blocks to N-bit blocks.
  77.   Let E_K(X) be the encryption of X under key K. Then, for any fixed K,
  78.   the map sending X to E_K(X) is a permutation of the set of N-bit
  79.   blocks. Denote this permutation by P_K. The set of all N-bit
  80.   permutations is called the symmetric group and is written S_{2^N}.
  81.   The collection of all these permutations P_K, where K ranges over all
  82.   possible keys, is denoted E(S_{2^N}). If E were a random mapping from
  83.   plaintexts to ciphertexts then we would expect E(S_{2^N}) to generate
  84.   a large subset of S_{2^N}.
  85.  
  86.   Coppersmith and Grossman [COP74] have shown that a very simple
  87.   product cipher can generate the alternating group A_{2^N} given a
  88.   sufficient number of rounds. (The alternating group is half of the
  89.   symmetric group: it consists of all ``even'' permutations, i.e., all
  90.   permutations which can be written as an even number of swaps.)
  91.   Even and Goldreich [EVE83] were able to extend these results to show
  92.   that Feistel ciphers can generate A_{2^N}, given a sufficient number
  93.   of rounds.
  94.  
  95.   The security of multiple encipherment also depends on the
  96.   group-theoretic properties of a cipher. Multiple encipherment is an
  97.   extension over single encipherment if for keys K1, K2 there does
  98.   not exist a third key K3 such that
  99.  
  100.   E_K2(E_K1(X)) == E_(K3)(X)                (**)
  101.  
  102.   which indicates that encrypting twice with two independent keys
  103.   K1, K2 is equal to a single encryption under the third key K3. If
  104.   for every K1, K2 there exists a K3 such that eq. (**) is true then
  105.   we say that E is a group.
  106.  
  107.   This question of whether DES is a group under this definition was
  108.   extensively studied by Sherman, Kaliski, and Rivest [SHE88]. In their
  109.   paper they give strong evidence for the hypothesis that DES is not a
  110.   group. In fact DES is not a group [CAM93].
  111.  
  112. 5.4. What can be proven about the security of a product cipher?
  113.  
  114.   Recall from above that P_K is a permutation produced by E under
  115.   some key K. The goal of the designer of E is to ensure that P_K
  116.   appears to be a random element of S_{2^N}, the symmetric group.
  117.   Let R be an element of S_{2^N} selected randomly. We will say that P_K
  118.   and R are indistinguishable if an observer given P_K and R in some
  119.   order cannot distinguish between these two permutations in polynomial
  120.   time. That is, with time bounded resources, the observer cannot
  121.   determine which of the permutations is produced by E: the optimal
  122.   decision is no better than simply guessing.
  123.  
  124.   Luby and Rackoff [LUB88] have shown that a class of Feistel ciphers
  125.   are secure in this sense when the round mapping is replaced by
  126.   random boolean functions.
  127.  
  128. 5.5. How are block ciphers used to encrypt data longer than the block size?
  129.  
  130.   There are four standard ``modes of operation'' (and numerous non-standard
  131.   ones as well). The standard modes of operation are defined in the U.S.
  132.   Department of Commerce Federal Information Processing Standard (FIPS) 81,
  133.   published in 1980. See the question about ECB below for more details.
  134.  
  135.   Although they are defined for the DES block cipher, the ``modes of
  136.   operation'' can be used with any block cipher.
  137.  
  138. 5.6. Can symmetric block ciphers be used for message authentication?
  139.  
  140.   You may use a symmetric cryptosystem block cipher to prove to yourself
  141.   that you generated a message, and that the message wasn't altered
  142.   after you created it. But you cannot prove these things to anyone else
  143.   without revealing your key. Thereafter you cannot prove anything about
  144.   messages authenticated with that key.
  145.   
  146.   See ANSI X3.106-1983 and FIPS 113 (1985) for a standard method of message
  147.   authentication using DES.
  148.  
  149. 5.7. What exactly is DES?
  150.  
  151.   DES is the U.S. Government's Data Encryption Standard, a product 
  152.   cipher that operates on 64-bit blocks of data, using a 56-bit key. 
  153.  
  154.   It is defined in FIPS 46-1 (1988) [which supersedes FIPS 46 (1977)].
  155.   FIPS are Federal Information Processing Standards published by NTIS.
  156.   DES is identical to the ANSI standard Data Encryption Algorithm (DEA)
  157.   defined in ANSI X3.92-1981. 
  158.  
  159. 5.8. What is triple DES?
  160.  
  161.   Triple DES is a product cipher which, like DES, operates on 64-bit 
  162.   data blocks. There are several forms, each of which uses the DES
  163.   cipher 3 times. Some forms use two 56-bit keys, some use three.
  164.   The DES ``modes of operation'' may also be used with triple-DES.
  165.  
  166.   Some people refer to E(K1,D(K2,E(K1,x))) as triple-DES.
  167.  
  168.   This method is defined in chapter 7.2 of the ANSI standard X9.17-1985
  169.   ``Financial Institution Key Management'' and is intended for use in
  170.   encrypting DES keys and IVs for ``Automated Key Distribution''. Its
  171.   formal name is ``Encryption and Decryption of a Single Key by a Key
  172.   Pair'', but it is referenced in other standards documents as EDE.
  173.  
  174.   That standard says (section 7.2.1): ``Key encrypting keys may be a single
  175.   DEA key or a DEA key pair. Key pairs shoud be used where additional
  176.   security is needed (e.g., the data protected by the key(s) has a long
  177.   security life). A key pair shall not be encrypted or decrypted using a
  178.   single key.''
  179.  
  180.   Others use the term ``triple-DES'' for E(K1,D(K2,E(K3,x))) or
  181.   E(K1,E(K2,E(K3,x))).
  182.  
  183.   Carl Ellison advocates triple DES use in the form
  184.  
  185.     E(K1, Tran( E(K2, Tran( E(K3, Compress( x )))))),
  186.  
  187.   where each DES instance has its own key and IV (for CBC mode) and Tran
  188.   is a large-block transposition program. Tran is available from [FTPTR].
  189.  
  190. 5.9. What is differential cryptanalysis?
  191.  
  192.   Differential cryptanalysis is a statistical attack that can be
  193.   applied to any iterated mapping (i.e., any mapping which is based on
  194.   a repeated round function). The method was recently popularized by
  195.   Biham and Shamir [BIH91], but Coppersmith has remarked that the
  196.   S-boxes of DES were optimized against this attack some 20 years ago.
  197.   This method has proved effective against several product ciphers,
  198.   notably FEAL [BI91a].
  199.  
  200.   Differential cryptanalysis is based on observing a large number of
  201.   ciphertexts Y, Y' whose corresponding plaintexts X, X' satisfy a
  202.   known difference D = X+X', where + is componentwise XOR. In the
  203.   basic Biham-Shamir attack, 2^{47} such plaintext pairs are required
  204.   to determine the key for DES. Substantially fewer pairs are required
  205.   if DES is truncated to 6 or 8 rounds. In these cases, the actual key
  206.   can be recovered in a matter of minutes using a few thousand pairs.
  207.   For full DES this attack is impractical because it requires so many
  208.   known plaintexts.
  209.  
  210.   The work of Biham and Shamir on DES revealed several startling
  211.   observations on the algorithm. Most importantly, if the key
  212.   schedule was removed from DES and a 16*48 = 768-bit key was used,
  213.   the key could be recovered in less than 2^{64} steps. Thus
  214.   independent subkeys do not add substantial security to DES.
  215.   Further, the S-boxes of DES are extremely sensitive in that
  216.   changing even single entries in these tables yields significant
  217.   improvement in the differential attack.
  218.  
  219.   Adi Shamir is quoted to say (NYTimes Oct 13 1991), ``I would say
  220.   that, contrary to what some people believe, there is no evidence
  221.   of tampering with the DES so that the basic design was weakened.''
  222.  
  223. 5.10. How was NSA involved in the design of DES?
  224.  
  225.   According to Kinnucan [KIN78], Tuchman, a member of the group that
  226.   developed DES at IBM is quoted as saying, ``We developed the DES
  227.   algorithm entirely within IBM using IBMers. The NSA did not
  228.   dictate a single wire!'' Tuchman and Meyer (another developer of
  229.   DES) spent a year breaking ciphers and finding weaknesses in
  230.   Lucifer. They then spent two years strengthening Lucifer. ``Their
  231.   basic approach was to look for strong substitution, permutation,
  232.   and key scheduling functions ... IBM has classified the notes
  233.   containing the selection criteria at the request of the NSA....
  234.   `The NSA told us we had inadvertently reinvented some of the deep
  235.   secrets it uses to make its own algorithms,' explains Tuchman.''
  236.   
  237.   On the other hand, a document called ``Involvement of the NSA in
  238.   the development of DES: unclassified summary of the United States
  239.   Select Committee on Intelligence'', printed in the IEEE
  240.   Communications Magazine, p53-55, 1978, states: ``In the development
  241.   of DES, NSA convinced IBM that a reduced keysize was sufficient;
  242.   indirectly assisted in the development of the S-box structures; and
  243.   certified that the final DES algorithm was, to the best of their
  244.   knowledge, free from any statistical or mathematical weakness.''
  245.  
  246.   Clearly the key size was reduced at the insistence of the NSA.
  247.   The article further states that the NSA did not tamper with the
  248.   algorithm itself, just the parameters, which in some sense
  249.   resolves the apparent conflict in the remarks of Meyer and Tuchman
  250.   presented above.
  251.  
  252. 5.11. Is DES available in software?
  253.  
  254.   Several people have made DES code available via ftp (see part 10 for
  255.   pathnames): Stig Ostholm [FTPSO]; BSD [FTPBK]; Eric Young [FTPEY];
  256.   Dennis Furguson [FTPDF]; Mark Riordan [FTPMR]; Phil Karn [FTPPK].
  257.   A Pascal listing of DES is also given in Patterson [PAT87].
  258.  
  259.   FIPS 46-1 says ``The algorithm specified in this standard is to be
  260.   implemented ... using hardware (not software) technology. ...
  261.   Software implementations in general purpose computers are not in
  262.   compliance with this standard.''  Despite this, software
  263.   implementations abound, and are used by government agencies.
  264.  
  265. 5.12. Is DES available in hardware?
  266.  
  267.   The following paragraphs are quoted from messages sent to the editors.
  268.   We don't vouch for the quality or even existence of the products.
  269.  
  270.   Chip Rosenthal says: ``Dallas Semiconductor makes a DES
  271.   encryption/decryption device for use on standard, digital 64Kbps PCM
  272.   telecom data streams. It is capable of processing data in real time,
  273.   e.g. one sample/frame. It is the DS2160. Their phone number is
  274.   214-450-0400. You would probably need to talk with Dewight in Telecom
  275.   marketing.''
  276.  
  277.   Christian Franke, franke@informatik.rwth-aachen.de, says: ``1.
  278.   Cryptech CRY12C102: 22.5Mbit/s according to Data Sheet, with 32 Bit
  279.   interface. We use this one, because it was the only one available when
  280.   we started the project. No problems !  2. Pijnenburg PCC100: 20Mbit/s
  281.   according to Data Sheet. Address: PIJNENBURG B.V., Boxtelswweg 26,
  282.   NL-5261 NE Vught, The Netherlands. 3. INFOSYS DES Chip (Germany):
  283.   S-Boxes must be loaded by software. So you can modify the Algorithm.
  284.   Sorry, I don't have the data sheet handy. Please E-Mail me if you need
  285.   further information.''
  286.  
  287.   Marcus J Ranum, mjr@tis.com, says: ``SuperCrypt'' 100Mb/sec and faster
  288.   DES and Proprietary Storage for 16 56-bit keys Key stream generator
  289.   Integrated hardware DES3 procedure Extended mode with 112 bit keys;
  290.   Computer Elektronik Infosys; 512-A Herndon Parkway,; Herndon, VA
  291.   22070; 800-322-3464.
  292.  
  293.   Tim Hember, thember@gandalf.ca, says: Newbridge Microsystems sells
  294.   an AM9568 compatible DES chip that operates at 25MHz, performs a
  295.   round of encryption in 18 clocks, has a three-stage pipeline,
  296.   supports ECB, CBC, CFB-8 and >>> CFB-1 <<<<. Further it is very
  297.   reasonable priced as opposed to other high-end DES chips. Call
  298.   Newbridge Microsystems, Ottawa, 613-592-0714. (... there are no
  299.   import/export issues with Canada and the US). If you require custom
  300.   DES or Public Key ICs then Timestep Engineering developed
  301.   Newbridge's crypto chips and ICs for other commercial and
  302.   educational establishments. They can be reached at 613-820-0024.
  303.  
  304. 5.13. Can DES be used to protect classified information?
  305.  
  306.   DES is not intended to protect classified data. FIPS 46-1 says:
  307.   ``This standard will be used by Federal departments and agencies for
  308.   the cryptographic protection of computer data when the following
  309.   conditions apply: 1. ... cryptographic protection is required; and
  310.   2. the data is not classified according to the National Security Act
  311.   of 1947, as amended, or the Atomic Energy Act of 1954, as amended.''
  312.  
  313. 5.14. What are ECB, CBC, CFB, OFB, and PCBC encryption?
  314.  
  315.   These are methods for using block ciphers, such as DES, to encrypt 
  316.   messages, files, and blocks of data, known as ``modes of operation.''
  317.   Four ``modes of operation'' are defined in FIPS 81 (1980 December 2), 
  318.   and also in ANSI X3.106-1983. 
  319.  
  320.   FIPS 81 specifies that when 7-bit ASCII data is sent in octets, the
  321.   unused most-significant bit is to be set to 1.
  322.  
  323.   FIPS 81 also specifies the padding for short blocks.
  324.  
  325.   The four FIPS/ANSI standard DES modes of operation are: 
  326.         Electronic Code Book  (ECB), 
  327.         Cipher Block Chaining (CBC), 
  328.         K-bit Cipher FeedBack (CFB), and 
  329.         K-bit Output FeedBack (OFB).
  330.  
  331.   All four of the ANSI/FIPS modes have very little "error extension".
  332.   For a single bit error in the cipherstream, none of them produce an
  333.   error burst in the decrypted output stream of longer than 128 bits.
  334.  
  335.   A fifth mode of operation, used in Kerberos and elsewhere but not
  336.   defined in any standard, is error-Propagating Cipher Block Chaining 
  337.   (PCBC).  Unlike the 4 standard modes, PCBC extends or propagates the
  338.   effect of a single bit error in the cipherstream throughout remainder 
  339.   of the decrypted textstream after the point of error.
  340.  
  341.   These 5 methods are explained below in a C-language-like notation.
  342.  
  343.   Some symbols:
  344.  
  345.   P[n]  The n'th block of plaintext, input to encryption, output from
  346.         decryption. Size of block determined by the mode.
  347.  
  348.   C[n]  The n'th block of ciphertext, output from encryption, input to
  349.         decryption. Size of block determined by the mode.
  350.  
  351.   E(m)  The DES encryption function, performed on 64-bit block m, using
  352.         the 16-key schedule derived from some 56-bit key.
  353.  
  354.   D(m)  The DES decryption function, performed on 64-bit block m, using
  355.         the same key schedule as in E(m), except that the 16 keys
  356.         in the schedule are used in the opposite order as in E(m).
  357.  
  358.   IV    A 64-bit ``initialization vector'', a secret value which, along with
  359.         the key, is shared by both encryptor and decryptor.
  360.  
  361.   I[n]  The n'th value of a 64-bit variable, used in some modes.
  362.   R[n]  The n'th value of a 64-bit variable, used in some modes.
  363.  
  364.   LSB(m,k) The k least significant (right-most) bits of m.
  365.         e.g. m & ((1 << k) - 1)
  366.  
  367.   MSB(m,k) The k most significant (left-most) bits of m.
  368.         e.g. (m >> (64-k)) & ((1 << k) - 1)
  369.  
  370.   = ^ << >> &  operators as defined in the c langage.
  371.  
  372.  
  373.   Electronic Code Book (ECB):
  374.  
  375.           P[n] and C[n] are each 64-bits long.
  376.  
  377.           Encryption:                   Decryption:
  378.           C[n] = E(P[n])                P[n] = D(C[n])
  379.  
  380.  
  381.   Cipher Block Chaining (CBC):
  382.  
  383.           P[n] and C[n] are each 64-bits long.
  384.  
  385.           Encryption:                   Decryption:
  386.           C[0] = E(P[0]^IV)             P[0] = D(C[0])^IV
  387.   (n>0)   C[n] = E(P[n]^C[n-1])         P[n] = D(C[n])^C[n-1]
  388.  
  389.  
  390.   Propagating Cipher Block Chaining (PCBC):
  391.  
  392.           P[n] and C[n] are each 64-bits long.
  393.  
  394.           Encryption:                   Decryption:
  395.           C[0] = E(P[0]^IV)             P[0] = D(C[0])^IV
  396.   (n>0)   C[n] = E(P[n]^P[n-1]^C[n-1])  P[n] = D(C[n])^P[n-1]^C[n-1]
  397.  
  398.  
  399.   k-bit Cipher FeedBack (CFB):
  400.  
  401.           P[n] and C[n] are each k bits long, 1 <= k <= 64. 
  402.  
  403.           Encryption:                   Decryption:
  404.           I[0] = IV                     I[0] = IV
  405.   (n>0)   I[n] = I[n-1]<<k | C[n-1]     I[n] = I[n-1]<<k | C[n-1]       
  406.   (all n) R[n] = MSB(E(I[n]),k)         R[n] = MSB(E(I[n]),k)
  407.   (all n) C[n] = P[n]^R[n]              P[n] = C[n]^R[n]
  408.  
  409.           Note that for k==64, this reduces to:
  410.  
  411.           I[0] = IV                     I[0] = IV
  412.   (n>0)   I[n] = C[n-1]                 I[n] = C[n-1]   
  413.   (all n) R[n] = E(I[n])                R[n] = E(I[n])
  414.   (all n) C[n] = P[n]^R[n]              P[n] = C[n]^R[n]
  415.  
  416.   CFB notes: Since I[n] depends only on the plain or cipher text from the
  417.   previous operation, the E() function can be performed in parallel with
  418.   the reception of the text with which it is used.
  419.  
  420.  
  421.   k-bit Output FeedBack (OFB):
  422.  
  423.           P[n] and C[n] are each k bits long, 1 <= k <= 64. 
  424.  
  425.           Encryption:                   Decryption:
  426.           I[0] = IV                     I[0] = IV
  427.   (n>0)   I[n] = I[n-1]<<k | R[n-1]     I[n] = I[n-1]<<k | R[n-1]       
  428.   (all n) R[n] = MSB(E(I[n]),k)         R[n] = MSB(E(I[n]),k)
  429.   (all n) C[n] = P[n]^R[n]              P[n] = C[n]^R[n]
  430.  
  431.           Note that for k==64, this reduces to:
  432.  
  433.           I[0] = IV                     I[0] = IV
  434.   (n>0)   I[n] = R[n-1]                 I[n] = R[n-1]   
  435.   (all n) R[n] = E(I[n])                R[n] = E(I[n])
  436.   (all n) C[n] = P[n]^R[n]              P[n] = C[n]^R[n]
  437.  
  438.   OFB notes: encryption and decryption are identical. Since I[n] is
  439.   independent of P and C, the E() function can be performed in advance of
  440.   the receipt of the plain/cipher text with which it is to be used.
  441.  
  442.  
  443.   Additional notes on DES ``modes of operation'':
  444.  
  445.   ECB and CBC use E() to encrypt and D() to decrypt, but the feedback
  446.   modes use E() to both encrypt and decrypt. This disproves the following 
  447.   erroneous claim: ``DES implementations which provide E() but not D()
  448.   cannot be used for data confidentiality.''
  449.