#include <ice.h>
ICE_KEY *ice_key_create (int level);
void ice_key_destroy (ICE_KEY *ik);
void ice_key_set (ICE_KEY *ik, const unsigned char *key);
void ice_key_encrypt (const ICE_KEY *ik,
const unsigned char *plaintext, unsigned char *ciphertext);
void ice_key_decrypt (const ICE_KEY *ik,
const unsigned char *ciphertext, unsigned char *plaintext);
int ice_key_key_size (const ICE_KEY *ik);
int ice_key_block_size (const ICE_KEY *ik);
The ICE library libice.a contains functions for encrypting and decrypting 64-bit blocks of data with the ICE (Information Concealment Engine) encryption algorithm.
The function ice_key_create()
creates a new ICE_KEY
that can be used to encrypt and decrypt data. The level of
encryption determines the size of the key, and hence its speed.
Level 0 uses the Thin-ICE variant, which is an 8-round cipher taking
an 8-byte key. This is the fastest option, and is generally considered
to be at least as secure as DES, although it is not yet certain whether
it is as secure as its key size.
For levels n greater than zero, a 16n-round cipher is used, taking 8n-byte keys. Although not as fast as level 0, these are very very secure.
Before an ICE_KEY
can be used to encrypt data, its key
schedule must be set with the ice_key_set()
function.
The length of the key required is determined by the level, as described
above.
The functions ice_key_encrypt()
and ice_key_decrypt()
encrypt and decrypt respectively data in blocks of eight characters, using
the specified key.
Two functions ice_key_key_size()
and
ice_key_block_size()
are provided which return the key and block size
respectively, measured in bytes. The key size is determined by
the level, while the block size is always 8.
To destroy a key when it is no longer needed, the function
ice_key_destroy()
should be used. As well as freeing up
memory, it zeroes it out, thus preventing snooping.