home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Secrets / Secrets2.iso / Graphics / Image / Crypta / Setup.EXE / SPECS.TXT < prev    next >
Encoding:
Text File  |  1997-03-16  |  9.2 KB  |  237 lines

  1.  
  2.                               CryptaPix (tm) 1.1
  3.                            Protocols and File Format
  4.  
  5.  
  6. Program Description
  7. -------------------
  8.  
  9. CryptaPix is a graphic image viewer for Windows-based personal computers.
  10. CryptaPix features a symmetric encryption option that allows the user to
  11. encrypt industry standard BMP, GIF, JPG, PCX, PNG, and TIF images.  The
  12. ciphertext output file is in a proprietary format with an extension of CPX.
  13. It contains a full sized image, a thumbnail representation of the image in
  14. BMP format, and (optionally) a WAV format sound clip.  All three sections
  15. are encrypted with either the PC1 or Blowfish algorithms.
  16.  
  17.  
  18. Blowfish Algorithm
  19. ------------------
  20.  
  21. Blowfish is a fast, unpatented variable size-key block encryption 
  22. algorithm invented by Bruce Schneier, security consultant and author of 
  23. "Applied Cryptography" (Wiley, ISBN 0-471-11709-9).  
  24.  
  25. The Blowfish algorithm used in CryptaPix follows the original specification
  26. as described in the April 1994 edition of Dr. Dobb's Journal and the 
  27. second edition of "Applied Cryptography" with two exceptions:
  28.  
  29. 1. The data blocks are processed in little-endian (least significant 
  30. byte first) format, the natural state for Intel-based processors.
  31.  
  32. 2. The p-array and s-boxes are initialized with the output of a linear 
  33. congruential random number generator (RNG) instead of the hexadecimal 
  34. digits of pi.  The RNG used is based on the formula: rng(i) = rng(i-1) * 
  35. 134775813 + 1, where rng is a 32-bit integer with an initial value of 
  36. ffffffff hex.
  37.  
  38. CryptaPix runs Blowfish with a 160-bit key in Cipher Block Chaining (CBC)
  39. mode.  An 8-byte initialization vector (IV) is generated from the 
  40. compiler's (Borland Delphi) pseudo random number generator (PRNG).  The 
  41. PRNG is seeded with data from the system clock at startup to ensure a 
  42. unique IV for each file.
  43.  
  44.  
  45. PC1 Algorithm
  46. -------------
  47.  
  48. PC1 is a very fast, unpatented variable size-key stream cipher that 
  49. produces an identical key stream as RSA Data Security Inc's RC4 
  50. algorithm.  The algorithm follows the RC4 specification as described by 
  51. Schneier in "Applied Cryptography".
  52.  
  53. CryptaPix runs PC1 with a key consisting of 40 or 80 bits of secret key
  54. material and 40 bits of salt provided by the compiler's PRNG.
  55.  
  56.  
  57. Export Restrictions
  58. -------------------
  59.  
  60. Due to U.S. export restrictions on encryption technology, the 80-bit PC1
  61. and 160-bit Blowfish algorithms are only available to registered users
  62. who reside in the U.S. or Canada.
  63.  
  64.  
  65. Key Generation
  66. --------------
  67.  
  68. Encryption keys are generated from the user's password.  Passwords can be
  69. up to 50 characters in length using any character available from the
  70. keyboard.  The user has the option of setting a "case sensitivity" flag at
  71. run-time which is saved in the header of the ciphertext file.  If this flag
  72. is disabled, the password is converted to uppercase.  
  73.  
  74. To discourage pre-computed dictionary attacks, five bytes of random salt
  75. from the compiler's PRNG are appended to the password and then run through
  76. the Secure Hash Algorithm (SHA-1) to produce a 160-bit hash value.  The
  77. lower 40 or 80 bits from the hash output are used as the secret portion of 
  78. the encryption key when the PC1 algorithm is used.  All 160 bits are used
  79. with the Blowfish algorithm.  The SHA-1 algorithm conforms to FIPS PUB 180-1
  80. specification as published by the National Institute of Standards and
  81. Technology (NIST).  The password salt is saved in the header of the
  82. ciphertext file.
  83.  
  84.  
  85. Key Confirmation
  86. ----------------
  87.  
  88. CryptaPix has a key confirmation feature that will determine if the user
  89. enters an incorrect password during decryption.  A 64-bit IV is filled
  90. with output from the compiler's PRNG.  
  91.  
  92. For the PC1 algorithm, the first 40 bits of the IV are used as salt for
  93. the key.  The other 24 bits of the IV are not used.  The 40 or 80-bit 
  94. encryption key is appended to the salt resulting in an 80 or 120-bit key.  
  95. The PC1 engine is then cycled 10,000 times with results discarded.  Two more 
  96. cycles are made and the 16-bit result is saved in the password check variable.  
  97. When the Blowfish algorithm is used, the 64-bit IV is encrypted with the
  98. key and the lower 16 bits of the resulting ciphertext is saved in the
  99. password check variable.
  100.  
  101. Both the IV and the password check variable are saved in the ciphertext
  102. file's header.  During decryption, the IV is retrieved from the header and
  103. the process is repeated.  If the password check matches the stored valued
  104. then the password is assumed to be correct and the decryption process
  105. continues.  
  106.  
  107. The global IV/salt is only used for the password check.  Each encrypted
  108. section in the output file uses a unique IV/salt.
  109.  
  110.  
  111. File Formats
  112. ------------
  113.  
  114. The default file extension for an encrypted CryptaPix file is ".CPX".
  115. CPX files begin with a file header, shown here in Pascal format:
  116.  
  117. fheader = record
  118.             id: array[1..4] of char;
  119.             version: byte;
  120.             encryption: byte;
  121.             pwcase: boolean;
  122.             pwsalt: array[1..5] of byte;
  123.             pwiv: array[1..8] of byte;
  124.             pwcheck: word;
  125.             ioffset: longint;
  126.             tnoffset: longint;
  127.             woffset: longint;
  128.           end;
  129.  
  130. The id field is always 'CPIX'.
  131. The version field is 10 which represents version 1.0.
  132. The three possible values for the encryption field are:
  133.   1: 40-bit PC1
  134.   2: 80-bit PC1 (not available in exportable version)
  135.   3: 160-bit Blowfish (not available in exportable version)
  136. The pwcase field is true (1) if the user set the password case sensitivity
  137. flag, otherwise it is false (0).
  138. The pwsalt field is 5 bytes of random salt from the compiler's PRNG.  These
  139. bytes are appended to the user's password before hashing with SHA-1.
  140. The pwiv field is 8 random bytes form the compiler's PRNG.  When encryption
  141. method 3 is used, all 8 bytes are used as an initialization vector for the
  142. password confirmation feature.  When encryption methods 1 and 2 are used,
  143. the first 5 bytes are used as a key salt.
  144. The pwcheck field is used for password confirmation as described earlier.
  145. The ioffset field contains the file offset for the encrypted image header.
  146. The tnoffset field contains the file offset for the encrypted thumbnail
  147. header.
  148. The woffset field contains the file offset for the encrypted WAV sound clip
  149. header.
  150.  
  151.  
  152. Image Header
  153. ------------
  154.  
  155. The offset of the image header is specified by the ioffset field in the
  156. main file header.  The format for the image header is shown here in Pascal
  157. format:
  158.  
  159. iheader = record
  160.             id: array[1..6] of char;
  161.             ext: string[3];
  162.             size: longint;
  163.             iv: array[1..8] of byte;
  164.           end;
  165.  
  166.  
  167. The id field is always 'CPIX00';
  168. The ext field is set to the source image's file extension: 'BMP', 'GIF',
  169. 'JPG', 'PCX', 'PNG', or 'TIF'.
  170. The size field is the original image's file size in bytes.
  171. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  172. method 3 is used, all 8 bytes are used as an initialization vector.  When
  173. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  174. salt.  
  175.  
  176. The encrypted image immediately follows the image header.  Random bytes are
  177. appended to the plaintext if necessary to make the output size a multiple
  178. of 8 bytes.
  179.  
  180.  
  181. Thumbnail Header
  182. ----------------
  183.  
  184. A thumbnail is a small (80 x 60 pixel) representation of the main image.
  185. CryptaPix creates it during the encryption process and saves it in an
  186. uncompressed 16-color gray scale BMP format.
  187.  
  188. The offset of the thumbnail header is specified by the tnoffset field in
  189. the main file header.  The format for the thumbnail header is shown here
  190. in Pascal format:
  191.  
  192. tnheader = record
  193.              id: array[1..6] of char;
  194.              size: longint;
  195.              iv: array[1..8] of byte;
  196.            end;
  197.  
  198. The id field is always 'CPIX01';
  199. The size field is the original thumbnail's file size in bytes.
  200. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  201. method 3 is used, all 8 bytes are used as an initialization vector.  When
  202. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  203. salt.
  204.  
  205. The encrypted thumbnail immediately follows the thumbnail header.  Random
  206. bytes are appended to the plaintext if necessary to make the output size a
  207. multiple of 8 bytes.
  208.  
  209.  
  210. WAV Header
  211. ----------
  212.  
  213. A WAV file is a sound clip in the industry standard WAV format.
  214.  
  215. The offset of the WAV header is specified by the woffset field in the main
  216. file header.  The format for the WAV header is shown here in Pascal format:
  217.  
  218. wheader = record
  219.             id: array[1..6] of char;
  220.             size: longint;
  221.             iv: array[1..8] of byte;
  222.           end;
  223.  
  224.  
  225. The id field is always 'CPIX02';
  226. The size field is the original WAV file size in bytes.  The size is set to
  227. 0 if no sound clip was saved with the file.
  228. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  229. method 3 is used, all 8 bytes are used as an initialization vector.  When
  230. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  231. salt.
  232.  
  233. The encrypted WAV sound immediately follows the WAV header.  Random bytes
  234. are appended to the plaintext if necessary to make the output size a
  235. multiple of 8 bytes.
  236.  
  237.