A new SetEncryption method for the FairCom.Isam.dll makes it possible to enable/disable file encryption from this interface. The following methods, along with the ENCRYPTION enumerator (which lists all possible encryption types), have been implemented:
static COUNT SetEncryption(ENCRYPTION mode, int keylen)
static COUNT SetEncryption(array<byte>^ key, int keylen)
Although this method is based on the standard c-treeDB SetEncryption() function, it has been modified to better comply with .NET requirements.
Typical calls from C#
Basic encryption:
byte[] enc = Encoding.ASCII.GetBytes("faircom");
int err = mCtree.SetEncryption(enc, enc.Length); // Enable
...
int err = mCtree.SetEncryption(enc, 0); // Disable
Advanced encryption:
int err = mCtree.SetEncryption(ENCRYPTION.DES8, 1); // Enable
...
int err = mCtree.SetEncryption(ENCRYPTION.DES8, 0); // Disable