Beispiel #1
0
 /// <summary>
 /// returns the encrypted string. for enyryption
 /// the password must be already set
 /// </summary>
 /// <param name="str">the string that should be encrypted</param>
 /// <returns></returns>
 private string getCryptStringContent(string str)
 {
     if (PConfigContent.password != null && str != null && PConfigContent.password.Length >= PrCrypt.MIN_LENGTH && !PrCrypt.error)
     {
         str = PrCrypt.Encrypt(str, PConfigContent.password);
     }
     return(str);
 }
Beispiel #2
0
        /// <summary>
        /// returns decypted flat content by using already known password
        ///
        /// </summary>
        /// <param name="valueName"></param>
        /// <param name="info"></param>
        /// <returns>decrypted string</returns>
        private string getDeCryptStringContent(string valueName, SerializationInfo info)
        {
            string str = (string)info.GetValue(valueName, typeof(string));

            if (PConfigContent.password != null && str != null && PConfigContent.password.Length >= PrCrypt.MIN_LENGTH && !PrCrypt.error)
            {
                str = PrCrypt.Decrypt(str, PConfigContent.password);
            }
            return(str);
        }