home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / crypto / crypfq08.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  17.8 KB  |  367 lines

  1.  
  2. Archive-name: cryptography-faq/part08
  3.  
  4.  
  5. This is the eighth 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. 8.1. How do I recover from lost passwords in WordPerfect?
  15. 8.2. How do I break a Vigenere (repeated-key) cipher?
  16. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  17. 8.4. Is the UNIX crypt command secure?
  18. 8.5. How do I use compression with encryption?
  19. 8.6. Is there an unbreakable cipher?
  20. 8.7. What does ``random'' mean in cryptography?
  21. 8.8. What is the unicity point (a.k.a. unicity distance)?
  22. 8.9. What is key management and why is it important?
  23. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  24. 8.11. What is the correct frequency list for English letters?
  25. 8.12. What is the Enigma?
  26. 8.13. How do I shuffle cards?
  27. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  28. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  29. 8.16. What is the coding system used by VCR+?
  30.  
  31.  
  32. 8.1. How do I recover from lost passwords in WordPerfect?
  33.  
  34.   WordPerfect encryption has been shown to be very easy to break.
  35.   The method uses XOR with two repeating key streams: a typed password
  36.   and a byte-wide counter initialized to 1+<the password length>. Full
  37.   descriptions are given in Bennett [BEN87] and Bergen and Caelli
  38.   [BER91].
  39.  
  40.   Chris Galas writes: ``Someone awhile back was looking for a way to
  41.   decrypt WordPerfect document files and I think I have a solution. 
  42.   There is a software company named: Accessdata (87 East 600 South,
  43.   Orem, UT 84058), 1-800-658-5199 that has a software package that will
  44.   decrypt any WordPerfect, Lotus 1-2-3, Quatro-Pro, MS Excel and Paradox
  45.   files. The cost of the package is $185. Steep prices, but if you
  46.   think your pw key is less than 10 characters, (or 10 char) give them a
  47.   call and ask for the free demo disk. The demo disk will decrypt files
  48.   that have a 10 char or less pw key.'' Bruce Schneier says the phone
  49.   number for AccessData is 801-224-6970.
  50.  
  51. 8.2. How do I break a Vigenere (repeated-key) cipher?
  52.  
  53.   A repeated-key cipher, where the ciphertext is something like the
  54.   plaintext xor KEYKEYKEYKEY (and so on), is called a Vigenere cipher.
  55.   If the key is not too long and the plaintext is in English, do the
  56.   following: 
  57.  
  58.   1. Discover the length of the key by counting coincidences.
  59.   (See Gaines [GAI44], Sinkov [SIN66].) Trying each displacement of
  60.   the ciphertext against itself, count those bytes which are equal. 
  61.   If the two ciphertext portions have used the same key, something
  62.   over 6% of the bytes will be equal. If they have used different
  63.   keys, then less than 0.4% will be equal (assuming random 8-bit bytes
  64.   of key covering normal ASCII text). The smallest displacement which
  65.   indicates an equal key is the length of the repeated key.
  66.  
  67.   2. Shift the text by that length and XOR it with itself. This
  68.   removes the key and leaves you with text XORed with itself. Since
  69.   English has about 1 bit of real information per byte, 2 streams of
  70.   text XORed together has 2 bits of info per 8-bit byte, providing
  71.   plenty of redundancy for choosing a unique decryption. (And in fact
  72.   one stream of text XORed with itself has just 1 bit per byte.)
  73.  
  74.   If the key is short, it might be even easier to treat this as a
  75.   standard polyalphabetic substitution. All the old cryptanalysis
  76.   texts show how to break those. It's possible with those methods, in
  77.   the hands of an expert, if there's only ten times as much text as key.
  78.   See, for example, Gaines [GAI44], Sinkov [SIN66].
  79.  
  80. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  81.  
  82.   Here's one popular method, using the des command:
  83.  
  84.     cat file | compress | des private_key | uuencode | mail
  85.  
  86.   Meanwhile, there is a de jure Internet standard in the works called
  87.   PEM (Privacy Enhanced Mail). It is described in RFCs 1421 through
  88.   1424. To join the PEM mailing list, contact pem-dev-request@tis.com.
  89.   There is a beta version of PEM being tested at the time of this
  90.   writing.
  91.  
  92.   There are also two programs available in the public domain for encrypting
  93.   mail: PGP and RIPEM. Both are available by FTP. Each has its own
  94.   newsgroup: alt.security.pgp and alt.security.ripem. Each has its own FAQ
  95.   as well.
  96.  
  97.   PGP is most commonly used outside the USA since it uses the RSA algorithm
  98.   without a license and RSA's patent is valid only (or at least primarily)
  99.   in the USA.
  100.  
  101.   RIPEM is most commonly used inside the USA since it uses the RSAREF which
  102.   is freely available within the USA but not available for shipment outside
  103.   the USA.
  104.  
  105.   Since both programs use a secret key algorithm for encrypting the body of
  106.   the message (PGP used IDEA; RIPEM uses DES) and RSA for encrypting the
  107.   message key, they should be able to interoperate freely. Although there
  108.   have been repeated calls for each to understand the other's formats and
  109.   algorithm choices, no interoperation is available at this time (as far as
  110.   we know).
  111.  
  112. 8.4. Is the UNIX crypt command secure?
  113.  
  114.   No. See [REE84]. There is a program available called cbw (crypt
  115.   breaker's workbench) which can be used to do ciphertext-only attacks
  116.   on files encrypted with crypt. One source for CBW is [FTPCB].
  117.  
  118. 8.5. How do I use compression with encryption?
  119.  
  120.   A number of people have proposed doing perfect compression followed by
  121.   some simple encryption method (e.g., XOR with a repeated key).
  122.  
  123.   Unfortunately, you can only compress perfectly if you know the exact
  124.   distribution of possible inputs. For all practical purposes it's
  125.   impossible to describe ``the typical English text'' beyond coarse
  126.   characteristics such as single-letter frequencies. You can build up
  127.   more and more sophisticated models of your inputs, but if the enemy
  128.   has a slightly more accurate model, he'll be able to find some
  129.   redundancy in your compressed output.
  130.  
  131.   Note that nearly all practical compression schemes, unless they
  132.   have been designed with cryptography in mind, produce output that
  133.   actually starts off with high redundancy. For example, the output of
  134.   UNIX compress begins with a well-known three-byte ``magic number''
  135.   that can serve as an entering wedge for cryptanalysis.
  136.   
  137.   This is not to say that compression before encryption is inherently a
  138.   bad idea; it just has to be done very, very carefully, and by no means
  139.   removes the need for strong encryption.
  140.  
  141.   Compression after encryption is silly.
  142.  
  143. 8.6. Is there an unbreakable cipher?
  144.  
  145.   Yes. The one-time pad is unbreakable; see part 4. Unfortunately the
  146.   one-time pad requires secure distribution of as much key material as
  147.   plaintext.
  148.  
  149.   Of course, a cryptosystem need not be utterly unbreakable to be
  150.   useful. Rather, it needs to be strong enough to resist attacks by
  151.   likely enemies for whatever length of time the data it protects is
  152.   expected to remain valid.
  153.  
  154. 8.7. What does ``random'' mean in cryptography?
  155.  
  156.   Cryptographic applications demand much more out of a pseudorandom
  157.   number generator than most applications. For a source of bits to be
  158.   cryptographically random, it must be computationally impossible to
  159.   predict what the Nth random bit will be given complete knowledge of
  160.   the algorithm or hardware generating the stream and the sequence of
  161.   0th through N-1st bits, for all N up to the lifetime of the source.
  162.  
  163.   A software generator (also known as pseudo-random) has the function
  164.   of expanding a truly random seed to a longer string of apparently
  165.   random bits. This seed must be large enough not to be guessed by
  166.   the opponent. Ideally, it should also be truly random (perhaps
  167.   generated by a hardware random number source).
  168.  
  169.   Those who have Sparcstation 1 workstations could, for example,
  170.   generate random numbers using the audio input device as a source of
  171.   entropy, by not connecting anything to it. For example,
  172.  
  173.         cat /dev/audio | compress - >foo
  174.  
  175.   gives a file of high entropy (not random but with much randomness in
  176.   it). One can then encrypt that file using part of itself as a key,
  177.   for example, to convert that seed entropy into a pseudo-random
  178.   string.
  179.  
  180.   When looking for hardware devices to provide this entropy, it is
  181.   important really to measure the entropy rather than just assume that
  182.   because it looks complicated to a human, it must be "random". For
  183.   example, disk operation completion times sound like they might be
  184.   unpredictable (to many people) but a spinning disk is much like a
  185.   clock and its output completion times are relatively low in entropy.
  186.  
  187. 8.8. What is the unicity point (a.k.a. unicity distance)?
  188.  
  189.   See [SHA49]. The unicity distance is an approximation to that amount
  190.   of ciphertext such that the sum of the real information (entropy) in
  191.   the corresponding source text and encryption key equals the number
  192.   of ciphertext bits used. Ciphertexts significantly longer than this
  193.   can be shown probably to have a unique decipherment. This is used to
  194.   back up a claim of the validity of a ciphertext-only cryptanalysis. 
  195.   Ciphertexts significantly shorter than this are likely to have
  196.   multiple, equally valid decryptions and therefore to gain security
  197.   from the opponent's difficulty choosing the correct one.
  198.  
  199.   Unicity distance, like all statistical or information-theoretic
  200.   measures, does not make deterministic predictions but rather gives
  201.   probabilistic results: namely, the minimum amount of ciphertext
  202.   for which it is likely that there is only a single intelligible
  203.   plaintext corresponding to the ciphertext, when all possible keys
  204.   are tried for the decryption. Working cryptologists don't normally
  205.   deal with unicity distance as such. Instead they directly determine
  206.   the likelihood of events of interest.
  207.  
  208.   Let the unicity distance of a cipher be D characters. If fewer than
  209.   D ciphertext characters have been intercepted, then there is not
  210.   enough information to distinguish the real key from a set of
  211.   possible keys. DES has a unicity distance of 17.5 characters,
  212.   which is less than 3 ciphertext blocks (each block corresponds to
  213.   8 ASCII characters). This may seem alarmingly low at first, but
  214.   the unicity distance gives no indication of the computational work
  215.   required to find the key after approximately D characters have been
  216.   intercepted.
  217.  
  218.   In fact, actual cryptanalysis seldom proceeds along the lines used
  219.   in discussing unicity distance. (Like other measures such as key
  220.   size, unicity distance is something that guarantees insecurity if
  221.   it's too small, but doesn't guarantee security if it's high.) Few
  222.   practical cryptosystems are absolutely impervious to analysis; all
  223.   manner of characteristics might serve as entering ``wedges'' to crack
  224.   some cipher messages. However, similar information-theoretic
  225.   considerations are occasionally useful, for example, to determine a
  226.   recommended key change interval for a particular cryptosystem.
  227.   Cryptanalysts also employ a variety of statistical and
  228.   information-theoretic tests to help guide the analysis in the most
  229.   promising directions.
  230.  
  231.   Unfortunately, most literature on the application of information
  232.   statistics to cryptanalysis remains classified, even the seminal
  233.   1940 work of Alan Turing (see [KOZ84]). For some insight into the
  234.   possibilities, see [KUL68] and [GOO83].
  235.  
  236. 8.9. What is key management and why is it important?
  237.  
  238.   One of the fundamental axioms of cryptography is that the enemy is in
  239.   full possession of the details of the general cryptographic system,
  240.   and lacks only the specific key data employed in the encryption. (Of
  241.   course, one would assume that the CIA does not make a habit of telling
  242.   Mossad about its cryptosystems, but Mossad probably finds out anyway.)
  243.   Repeated use of a finite amount of key provides redundancy that can
  244.   eventually facilitate cryptanalytic progress. Thus, especially in
  245.   modern communication systems where vast amounts of information are
  246.   transferred, both parties must have not only a sound cryptosystem but
  247.   also enough key material to cover the traffic.
  248.  
  249.   Key management refers to the distribution, authentication, and
  250.   handling of keys.
  251.  
  252.   A publicly accessible example of modern key management technology
  253.   is the STU III secure telephone unit, which for classified use
  254.   employs individual coded ``Crypto Ignition Keys'' and a central Key
  255.   Management Center operated by NSA. There is a hierarchy in that
  256.   certain CIKs are used by authorized cryptographic control
  257.   personnel to validate the issuance of individual traffic keys and
  258.   to perform installation/maintenance functions, such as the
  259.   reporting of lost CIKs.
  260.  
  261.   This should give an inkling of the extent of the key management
  262.   problem. For public-key systems, there are several related issues,
  263.   many having to do with ``whom do you trust?''
  264.  
  265. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  266.  
  267.   Chaotic equations and fractals produce an apparent randomness from
  268.   relatively compact generators. Perhaps the simplest example is a
  269.   linear congruential sequence, one of the most popular types of random
  270.   number generators, where there is no obvious dependence between seeds
  271.   and outputs. Unfortunately the graph of any such sequence will, in a
  272.   high enough dimension, show up as a regular lattice. Mathematically
  273.   this lattice corresponds to structure which is notoriously easy for
  274.   cryptanalysts to exploit. More complicated generators have more
  275.   complicated structure, which is why they make interesting pictures---
  276.   but a cryptographically strong sequence will have no computable
  277.   structure at all.
  278.  
  279.   See [KNU81], exercise 3.5-7; [REE77]; and [BOY89].
  280.  
  281. 8.11. What is the correct frequency list for English letters?
  282.  
  283.   There are three answers to this question, each slightly deeper than
  284.   the one before. You can find the first answer in various books:
  285.   namely, a frequency list computed directly from a certain sample of
  286.   English text.
  287.  
  288.   The second answer is that ``the English language'' varies from author
  289.   to author and has changed over time, so there is no definitive list.
  290.   Of course the lists in the books are ``correctly'' computed, but
  291.   they're all different: exactly which list you get depends on which
  292.   sample was taken. Any particular message will have different
  293.   statistics from those of the language as a whole.
  294.  
  295.   The third answer is that yes, no particular message is going to have
  296.   exactly the same characteristics as English in general, but for all
  297.   reasonable statistical uses these slight discrepancies won't matter.
  298.   In fact there's an entire field called ``Bayesian statistics'' (other
  299.   buzzwords are ``maximum entropy methods'' and ``maximum likelihood
  300.   estimation'') which studies questions like ``What's the chance that a
  301.   text with these letter frequencies is in English?'' and comes up with
  302.   reasonably robust answers.
  303.  
  304.   So make your own list from your own samples of English text. It will
  305.   be good enough for practical work, if you use it properly.
  306.  
  307. 8.12. What is the Enigma?
  308.  
  309.   ``For a project in data security we are looking for sources of
  310.   information about the German Enigma code and how it was broken by
  311.   the British during WWII.''
  312.  
  313.   See [WEL82], [DEA85], [KOZ84], [HOD83], [KAH91].
  314.  
  315. 8.13. How do I shuffle cards?
  316.  
  317.   Card shuffling is a special case of the permutation of an array of
  318.   values, using a random or pseudo-random function. All possible output
  319.   permutations of this process should be equally likely. To do this, you
  320.   need a random function (modran(x)) which will produce a uniformly
  321.   distributed random integer in the interval [0..x-1]. Given that
  322.   function, you can shuffle with the following [C] code: (assuming ARRLTH
  323.   is the length of array arr[] and swap() interchanges values at the two
  324.   addresses given)
  325.  
  326.   for ( n = ARRLTH-1; n > 0 ; n-- ) swap( &arr[modran( n+1 )], &arr[n] ) ;
  327.  
  328.   modran(x) can not be achieved exactly with a simple (ranno() % x) since
  329.   ranno()'s interval may not be divisible by x, although in most cases the
  330.   error will be very small. To cover this case, one can take ranno()'s
  331.   modulus mod x, call that number y, and if ranno() returns a value less
  332.   than y, go back and get another ranno() value.
  333.  
  334.   See [KNU81] for further discussion.
  335.  
  336. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  337.  
  338.   Someone will frequently express the desire to publish a CD-ROM with
  339.   possibly multiple pieces of software, perhaps with each encrypted
  340.   separately, and will want to use different keys for each user (perhaps
  341.   even good for only a limited period of time) in order to avoid piracy.
  342.  
  343.   As far as we know, this is impossible, since there is nothing in standard
  344.   PC or workstation hardware which uniquely identifies the user at the
  345.   keyboard. If there were such an identification, then the CD-ROM could be
  346.   encrypted with a key based in part on the one sold to the user and in
  347.   part on the unique identifier. However, in this case the CD-ROM is one
  348.   of a kind and that defeats the intended purpose.
  349.  
  350.   If the CD-ROM is to be encrypted once and then mass produced, there must
  351.   be a key (or set of keys) for that encryption produced at some stage in
  352.   the process. That key is useable with any copy of the CD-ROM's data.
  353.   The pirate needs only to isolate that key and sell it along with the
  354.   illegal copy.
  355.  
  356. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  357.  
  358.   Certainly. For commercial products you can try AccessData; see
  359.   question 8.1. We are not aware of any FTP sites for such software,
  360.   but there are many papers on the subject. See [PEL79], [LUC88],
  361.   [CAR86], [CAR87], [KOC87], [KOC88], [KIN92], [KIN93], [SPI93].
  362.  
  363. 8.16. What is the coding system used by VCR+?
  364.  
  365.   One very frequently asked question in sci.crypt is how the VCR+ codes
  366.   work. See [SHI92] for an attempt to describe it.
  367.