Chapter 3 Cryptography 87
Choosing Algorithms
Choosing Algorithms
In some cases, an applications constraints determine the algorithm. In other cases, the
developer can choose among a number of algorithm options and still produce a viable
PKI solution. This section presents suggestions to help you determine the best choice.

Public-Key vs. Symmetric-Key Cryptography

Because symmetric-key encryption algorithms are much faster than public-key
algorithms, they are most suited for bulk data encryption.
Public-key encryption should not be used for encrypting large amounts of data. It is
best used to encrypt keys for either a digital envelope method or for key escrow
applications.

Stream vs. Block Symmetric-Key Algorithms

Crypto-C has only one stream encryption algorithm, the RC4 cipher. The RC4 cipher
produces an encrypted output the same size as the original input message and is
significantly faster than block-encryption algorithms. However, once a key has been
used to encrypt a particular message, it should not be used again. Hence, employing
the RC4 cipher requires using many keys. If managing many keys is difficult, the RC4
cipher may not provide the easiest solution.
Some applications do not save keys outside of the session. For these applications, the
RC4 cipher will generally be a good choice. For instance, in encrypted phone
conversations, the symmetric key is a session key. It encrypts for one call; once the
session is over, the key is discarded. Another example would be an email application
where the session key is encrypted with an RSA public key and is a part of the data
package.
The RC4 cipher has a variable length key. If you set the key to be long enough, the
RC4 cipher offers greater security than DES.
Block-encryption algorithms are best used for applications that require repeated
encryptions without changing the value of the key. In addition, DES is a standard
used by many applications. If an application must be able to communicate with other
applications, DES is a safe choice for universal support.