Welcome to CHelix, a C++ implementation for the Helix Encryption and Authentication algorithm as presented in a November 2003 Dr. Dobb's Journal article by Niels Ferguson and Bruce Schneier. For further information please refer to the article and / or the web site for it at http://www.macfergus.com/helix.
Features |
Copyright |
History |
API Reference |
Contacting the Author |
V1.0 (29 November 2003)
V1.01 (30 November 2003)
V1.02 (1 December 2003)
V1.03 (1 December 2003)
V1.04 (18 June 2004)
V1.05 (17 September 2004)
V1.06 (28 October 2004)
V1.07 (30 December 2006)
The API consists of the public methods of the CHelix class. They consist of:
CHelix::SetKey
CHelix::Encrypt
CHelix::Decrypt
bool SetKey(const BYTE* pbyKey, DWORD dwKeyLength);
Parameters
pbyKey Pointer to a data to encrypt.
dwKeyLength The length of the key "pByKey" in bytes.
Return Value
true if the key was set otherwise false.
Remarks
Initializes the helix instance using the secret value "pbyKey" and length "nLength". The maximum value for the key is 32 bytes. The secret key should be known only to the sender and receiver.
bool Encrypt(const BYTE* pbyPlainText, DWORD dwPlainTextSize, const CHelixNonce& nonce, BYTE* pbyCipherText, CHelixMAC& mac);
Parameters
pbyPlainText Pointer to the data to encrypt.
dwPlainTextSize The size in bytes of the data in "pbyPlainText".
nonce The cryptographic nonce to use for the encryption. This is a 16 byte value which should be unique for each message to be encrypted.
pbyCipherText Pointer to the buffer which receives the encrypted data upon return of the function. The buffer should be the same size (or greater) than "dwPlainTextSize" bytes in size.
mac Pointer to the message authentication code (aka hash or digest) for the data which is filled in upon return.
Return Value
true if the data was encrypted successfully otherwise false.
Remarks
To encrypt data in place, set "pbyCipherText" to be the same value as "pbyPlainText".
Decrypt();
bool Decrypt(const BYTE* pbyCipherText, DWORD dwCipherTextSize, const CHelixNonce& nonce, const CHelixMAC& mac, BYTE* pbyPlainText);
Parameters
pbyCipherText Pointer to the data to decrypt.
dwCipherTextSize The size in bytes of the data in "pbyCipherText".
nonce The cryptographic nonce to use for the decryption. This is the 16 byte value which should be transmitted with the encrypted data such as in a Message sequence number or other counter.
mac Pointer to the message authentication code (aka hash or digest) for the data. Again this should be transmitted with the encrypted data.
pbyPlainText Pointer to the buffer which receives the decrypted data upon return of the function. The buffer should be the same size (or greater) than "dwCipherTextSize" bytes in size.
Return Value
true if the received MAC "mac" is the same as the calculated mac from the actual received data otherwise false.
Remarks
To decrypt data in place, set "pbyPlainText" to be the same value as "pbyCipherText".
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
30 December 2006