home *** CD-ROM | disk | FTP | other *** search
-
- CryptaPix (tm) 1.1
- Protocols and File Format
-
-
- Program Description
- -------------------
-
- CryptaPix is a graphic image viewer for Windows-based personal computers.
- CryptaPix features a symmetric encryption option that allows the user to
- encrypt industry standard BMP, GIF, JPG, PCX, PNG, and TIF images. The
- ciphertext output file is in a proprietary format with an extension of CPX.
- It contains a full sized image, a thumbnail representation of the image in
- BMP format, and (optionally) a WAV format sound clip. All three sections
- are encrypted with either the PC1 or Blowfish algorithms.
-
-
- Blowfish Algorithm
- ------------------
-
- Blowfish is a fast, unpatented variable size-key block encryption
- algorithm invented by Bruce Schneier, security consultant and author of
- "Applied Cryptography" (Wiley, ISBN 0-471-11709-9).
-
- The Blowfish algorithm used in CryptaPix follows the original specification
- as described in the April 1994 edition of Dr. Dobb's Journal and the
- second edition of "Applied Cryptography" with two exceptions:
-
- 1. The data blocks are processed in little-endian (least significant
- byte first) format, the natural state for Intel-based processors.
-
- 2. The p-array and s-boxes are initialized with the output of a linear
- congruential random number generator (RNG) instead of the hexadecimal
- digits of pi. The RNG used is based on the formula: rng(i) = rng(i-1) *
- 134775813 + 1, where rng is a 32-bit integer with an initial value of
- ffffffff hex.
-
- CryptaPix runs Blowfish with a 160-bit key in Cipher Block Chaining (CBC)
- mode. An 8-byte initialization vector (IV) is generated from the
- compiler's (Borland Delphi) pseudo random number generator (PRNG). The
- PRNG is seeded with data from the system clock at startup to ensure a
- unique IV for each file.
-
-
- PC1 Algorithm
- -------------
-
- PC1 is a very fast, unpatented variable size-key stream cipher that
- produces an identical key stream as RSA Data Security Inc's RC4
- algorithm. The algorithm follows the RC4 specification as described by
- Schneier in "Applied Cryptography".
-
- CryptaPix runs PC1 with a key consisting of 40 or 80 bits of secret key
- material and 40 bits of salt provided by the compiler's PRNG.
-
-
- Export Restrictions
- -------------------
-
- Due to U.S. export restrictions on encryption technology, the 80-bit PC1
- and 160-bit Blowfish algorithms are only available to registered users
- who reside in the U.S. or Canada.
-
-
- Key Generation
- --------------
-
- Encryption keys are generated from the user's password. Passwords can be
- up to 50 characters in length using any character available from the
- keyboard. The user has the option of setting a "case sensitivity" flag at
- run-time which is saved in the header of the ciphertext file. If this flag
- is disabled, the password is converted to uppercase.
-
- To discourage pre-computed dictionary attacks, five bytes of random salt
- from the compiler's PRNG are appended to the password and then run through
- the Secure Hash Algorithm (SHA-1) to produce a 160-bit hash value. The
- lower 40 or 80 bits from the hash output are used as the secret portion of
- the encryption key when the PC1 algorithm is used. All 160 bits are used
- with the Blowfish algorithm. The SHA-1 algorithm conforms to FIPS PUB 180-1
- specification as published by the National Institute of Standards and
- Technology (NIST). The password salt is saved in the header of the
- ciphertext file.
-
-
- Key Confirmation
- ----------------
-
- CryptaPix has a key confirmation feature that will determine if the user
- enters an incorrect password during decryption. A 64-bit IV is filled
- with output from the compiler's PRNG.
-
- For the PC1 algorithm, the first 40 bits of the IV are used as salt for
- the key. The other 24 bits of the IV are not used. The 40 or 80-bit
- encryption key is appended to the salt resulting in an 80 or 120-bit key.
- The PC1 engine is then cycled 10,000 times with results discarded. Two more
- cycles are made and the 16-bit result is saved in the password check variable.
- When the Blowfish algorithm is used, the 64-bit IV is encrypted with the
- key and the lower 16 bits of the resulting ciphertext is saved in the
- password check variable.
-
- Both the IV and the password check variable are saved in the ciphertext
- file's header. During decryption, the IV is retrieved from the header and
- the process is repeated. If the password check matches the stored valued
- then the password is assumed to be correct and the decryption process
- continues.
-
- The global IV/salt is only used for the password check. Each encrypted
- section in the output file uses a unique IV/salt.
-
-
- File Formats
- ------------
-
- The default file extension for an encrypted CryptaPix file is ".CPX".
- CPX files begin with a file header, shown here in Pascal format:
-
- fheader = record
- id: array[1..4] of char;
- version: byte;
- encryption: byte;
- pwcase: boolean;
- pwsalt: array[1..5] of byte;
- pwiv: array[1..8] of byte;
- pwcheck: word;
- ioffset: longint;
- tnoffset: longint;
- woffset: longint;
- end;
-
- The id field is always 'CPIX'.
- The version field is 10 which represents version 1.0.
- The three possible values for the encryption field are:
- 1: 40-bit PC1
- 2: 80-bit PC1 (not available in exportable version)
- 3: 160-bit Blowfish (not available in exportable version)
- The pwcase field is true (1) if the user set the password case sensitivity
- flag, otherwise it is false (0).
- The pwsalt field is 5 bytes of random salt from the compiler's PRNG. These
- bytes are appended to the user's password before hashing with SHA-1.
- The pwiv field is 8 random bytes form the compiler's PRNG. When encryption
- method 3 is used, all 8 bytes are used as an initialization vector for the
- password confirmation feature. When encryption methods 1 and 2 are used,
- the first 5 bytes are used as a key salt.
- The pwcheck field is used for password confirmation as described earlier.
- The ioffset field contains the file offset for the encrypted image header.
- The tnoffset field contains the file offset for the encrypted thumbnail
- header.
- The woffset field contains the file offset for the encrypted WAV sound clip
- header.
-
-
- Image Header
- ------------
-
- The offset of the image header is specified by the ioffset field in the
- main file header. The format for the image header is shown here in Pascal
- format:
-
- iheader = record
- id: array[1..6] of char;
- ext: string[3];
- size: longint;
- iv: array[1..8] of byte;
- end;
-
-
- The id field is always 'CPIX00';
- The ext field is set to the source image's file extension: 'BMP', 'GIF',
- 'JPG', 'PCX', 'PNG', or 'TIF'.
- The size field is the original image's file size in bytes.
- The iv field is 8 random bytes from the compiler's PRNG. When encryption
- method 3 is used, all 8 bytes are used as an initialization vector. When
- encryption methods 1 and 2 are used, the first 5 bytes are used as a key
- salt.
-
- The encrypted image immediately follows the image header. Random bytes are
- appended to the plaintext if necessary to make the output size a multiple
- of 8 bytes.
-
-
- Thumbnail Header
- ----------------
-
- A thumbnail is a small (80 x 60 pixel) representation of the main image.
- CryptaPix creates it during the encryption process and saves it in an
- uncompressed 16-color gray scale BMP format.
-
- The offset of the thumbnail header is specified by the tnoffset field in
- the main file header. The format for the thumbnail header is shown here
- in Pascal format:
-
- tnheader = record
- id: array[1..6] of char;
- size: longint;
- iv: array[1..8] of byte;
- end;
-
- The id field is always 'CPIX01';
- The size field is the original thumbnail's file size in bytes.
- The iv field is 8 random bytes from the compiler's PRNG. When encryption
- method 3 is used, all 8 bytes are used as an initialization vector. When
- encryption methods 1 and 2 are used, the first 5 bytes are used as a key
- salt.
-
- The encrypted thumbnail immediately follows the thumbnail header. Random
- bytes are appended to the plaintext if necessary to make the output size a
- multiple of 8 bytes.
-
-
- WAV Header
- ----------
-
- A WAV file is a sound clip in the industry standard WAV format.
-
- The offset of the WAV header is specified by the woffset field in the main
- file header. The format for the WAV header is shown here in Pascal format:
-
- wheader = record
- id: array[1..6] of char;
- size: longint;
- iv: array[1..8] of byte;
- end;
-
-
- The id field is always 'CPIX02';
- The size field is the original WAV file size in bytes. The size is set to
- 0 if no sound clip was saved with the file.
- The iv field is 8 random bytes from the compiler's PRNG. When encryption
- method 3 is used, all 8 bytes are used as an initialization vector. When
- encryption methods 1 and 2 are used, the first 5 bytes are used as a key
- salt.
-
- The encrypted WAV sound immediately follows the WAV header. Random bytes
- are appended to the plaintext if necessary to make the output size a
- multiple of 8 bytes.
-
-