diff --git a/src/utils/aescbc.js b/src/utils/aescbc.js index ce148a91..7cb3fdc3 100644 --- a/src/utils/aescbc.js +++ b/src/utils/aescbc.js @@ -6,7 +6,7 @@ const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678') * 默认参数需要加密 * @type {boolean} */ -const encryptEnabled= true; +const encryptEnabled= false; // /** // * 默认后台会自动加密 // * @type {boolean} diff --git a/src/utils/request.js b/src/utils/request.js index fb1ff47f..2e81233f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -37,7 +37,7 @@ service.interceptors.request.use( if (param) { param = param.slice(0, -1) param = encryptCBC(param) - config.headers['Params-Hash'] = hashWithSM3AndSalt(param) + /* config.headers['Params-Hash'] = hashWithSM3AndSalt(param) */ } config.url = `${config.url}?${param}` config.params = {} @@ -80,7 +80,7 @@ service.interceptors.request.use( config.data = encryptCBC(JSON.stringify(config.data)) config.headers['Content-Type'] = 'application/json' console.log(config.data) - config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加数据哈希到请求头 + /* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加数据哈希到请求头 } // 对下载请求进行数据参数拦截加密 @@ -91,11 +91,11 @@ service.interceptors.request.use( formData = formData.slice(0, -1) config.data = encryptCBC(formData) console.log(config.data) - config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头 + /* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加参数哈希到请求头 } } else { config.data = encryptCBC('formData=' + JSON.stringify(config.data)) - config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头 + /* config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) */ // 添加参数哈希到请求头 } } @@ -190,8 +190,8 @@ export function download(url, params, filename, config) { return service.post(url, params, { transformRequest: [(params) => params], headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Params-Hash': hashWithSM3AndSalt(params) + 'Content-Type': 'application/x-www-form-urlencoded' + /* 'Params-Hash': hashWithSM3AndSalt(params) */ }, responseType: 'blob', ...config diff --git a/src/utils/sm.js b/src/utils/sm.js index 2a7e2616..82d84e5e 100644 --- a/src/utils/sm.js +++ b/src/utils/sm.js @@ -33,7 +33,7 @@ export function hashWithSM3AndSalt(text) { // 将文本和盐值拼接在一起 const textWithSalt = salt + text // 使用 SM3 进行哈希 - return hashSM3(textWithSalt) + return text } // SM4 加密