Exemple #1
0
        /// <summary>
        /// Set the password for encryption algorithm used to encrypt database data
        /// </summary>
        /// <param name="pwd">The password</param>
        public static void SetEncryptionPassword(string pwd)
        {
            int keyLength = 32;//used by XTEA algorithm

            byte[]        key = ByteConverter.SerializeValueType(pwd, typeof(string), keyLength, keyLength, 0);
            XTEAEncryptor enc = Encryptor as XTEAEncryptor;

            if (enc != null)
            {
                enc.SetKey(key);
            }
            AESEncryptor encAes = Encryptor as AESEncryptor;

            if (encAes != null)
            {
                encAes.SetKey(key);
            }
        }