|
SetEncryption
Set or reset encryption key.
Short Name
ctSETENCRYPT()
Type
Low-level function
Declaration
COUNT SetEncryption(pTEXT mod, pTEXT key, VRLEN keylen)
Description
To encode index and data files without a parameter file, use SetEncryption() before the create file calls.
- mod should be NULL or point to a null-terminated ASCII string. mod is used only with with Advanced File Encryption.
- key points to a byte array which comprises the encryption key, of length keylen.
SetEncryption() does not assume that key points to a null-terminated ASCII string. key can be any arbitrary array of bytes. Key lengths of seven or more should be adequate. To stop encrypting new files, call SetEncryption() with key set to NULL and/or keylen set to zero. (key and keylen are ignored for Advanced Encryption algorithms.)
Available ciphers
Symbolic Constant
|
Description
|
ctENCR
|
FairCom Standard File Encryption - See “Standard File Encryption”.
|
ctAES16 ctAES24 ctAES32
|
Advanced Encryption Standard (AES) - Rijndael encryption algorithm implementation based on code made public by the Rijndael web page as an NIST AES finalist. For more information regarding this standard, refer to “Rijndael Web Site (AES Encryption)”. According to the Rijndael web site: “Rijndael is available for free. You can use it for whatever purposes you want, irrespective of whether it is accepted as AES or not."
|
ctDES8 ctDES16 ctDES24
|
Data Encryption Standard - DES encryption algorithm based on a description published by Bruce Schneier in “Applied Cryptography 2nd Edition.” (ISBN 0-471-12845-7)
|
ctBLF8 through ctBLF56
|
Blowfish encryption algorithm implementation based on code made public by Bruce Schneier of Counterpane Internet Security Inc. For more information regarding this standard, refer to “Blowfish Encryption Web Site”. According to the Counterpane web site about Blowfish: “Blowfish is unpatented and license-free, and is available free for all uses."
|
ctTWF16 ctTWF24 ctTWF32
|
Twofish encryption algorithm implementation based on code made public by Counterpane Internet Security Inc, as one of the NIST AES finalist. For more information regarding this standard, refer to “Twofish Encryption Web Site”. According to the Counterpane web site about Twofish: “Twofish is unpatented, and the source code is uncopyrighted and license-free; it is free for all uses."
|
SetEncryption() only affects file creation operations. All files created after a given call to SetEncryption(), with a non-NULL key and a keylen greater than zero, will be encrypted with the same key. Therefore, at the ISAM level, a data file and its associated indices will be created with the same encryption key. Turning encryption on and off through calls to SetEncryption() only affects whether or not a new file is encrypted. Once a file is set for encryption, it is always encrypted.
The following pseudo-code encrypts the first ISAM data file and its indices, and does not encrypt the second ISAM data file and its indices.
SetEncryption Examples
InitISAM(...)
SetEncryption (NULL, key, (VRLEN) 23)
CreateIFile(..1..)
SetEncryption (NULL, NULL, (VRLEN) 0)
CreateIFile(..2..)
To use Advanced Encryption ciphers:
InitISAM(...)
SetEncryption ((pTEXT)ctAES32, NULL, (VRLEN) 0)
CreateIFile(..1..)
SetEncryption (NULL, NULL, (VRLEN) 0)
CreateIFile(..2..)
Note: SetEncryption() does not enable transaction log file encryption. Use the LOG_ENCRYPT configuration option to encrypt transaction log data.
Return
Value
|
Symbolic Constant
|
Explanation
|
0
|
NO_ERROR
|
Successful operation.
|
82
|
UALC_ERR
|
No memory available to allocate.
|
454
|
NSUP_ERR
|
ctCAMO not defined. Service not supported.
|
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.
|