Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="value"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public static string EncryptByClientKey(string value, string key)
 {
     if (string.IsNullOrEmpty(value))
     {
         return(null);
     }
     return(SecureEngineH5.Encrypt(value, key, key));
 }
Пример #2
0
        /// <summary>
        /// convert server side encrypted value to client side encrypted value
        /// - first decrypt value by server key , and then encrypt by client's key
        /// </summary>
        /// <param name="value">encrypted value(server)</param>
        /// <param name="key">client key</param>
        /// <returns>encrypted value(client)</returns>
        public static string EncryptFromSeverToClient(string value, string key)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            string val = value;

            if (SecureEngine.IsEncrypted(value))
            {
                val = SecureEngine.Decrypt(value);
            }
            return(SecureEngineH5.Encrypt(val, key, key));
        }