/// <summary> /// Decrypt value by client key /// </summary> /// <param name="value">encrypted value</param> /// <param name="key">decrypted value</param> /// <returns></returns> public static string DecryptByClientKey(string value, string key) { if (string.IsNullOrEmpty(value)) { return(null); } return(SecureEngineH5.Decrypt(value, key, key)); }
/// <summary> /// encrypt Clent side encrytion to Server Side Encryption /// - first decrypt client side encrypted by client key , then encrypt that value by server key; /// </summary> /// <param name="value">encrypted value(client)</param> /// <param name="key">client key</param> /// <returns>encrypted value (server side)</returns> public static string EncryptFromClientToServer(string value, string key) { if (string.IsNullOrEmpty(value)) { return(null); } string val = SecureEngineH5.Decrypt(value, key, key); return(SecureEngineUtility.SecureEngine.Encrypt(val)); }
/// <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)); }