💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 ``` /** * @category ES解密 * @param instr * 入参|加密字符串|{@link java.lang.String} * @param key * 入参|加密密钥|{@link java.lang.String} * @param decstr * 出参|解密后的字符串|{@link java.lang.String} * @return -1 异常<br/> * 1 成功<br/> */ @InParams(param = { @Param(name = "instr", comment = "加密字符串", type = java.lang.String.class), @Param(name = "key", comment = "加密密钥", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "decstr", comment = "解密后的字符串", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) @Component(label = "3DES解密", style = "判断型", type = "同步组件", version = "1.0.0", deprecated = false, author = "test", date = "2018-01-19 05:08:46") public static ResultBase P_des3Dec(String instr, String key) { String strErr = ""; try { key += " "; Key deskey = null; DESedeKeySpec spec = new DESedeKeySpec(key.getBytes()); SecretKeyFactory keyfactory = SecretKeyFactory .getInstance("desede"); deskey = keyfactory.generateSecret(spec); Cipher cipher = Cipher.getInstance("desede" + "/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, deskey); // EBCD解码 byte[] by = new byte[instr.length() / 2]; for (int i = 0; i < instr.length(); i += 2) by[i / 2] = (byte) Integer.parseInt(instr.substring(i, i + 2), 16); byte[] bOut = cipher.doFinal(by); return ResultBase.newSuccessResult(new String(bOut)); } catch (Exception ex) { AppLog.error(ex); strErr = AppLog.errorMsg(ex); } return ResultBase .newExceptionResult("TPTS0004", "3DES解密出现异常:" + strErr); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/6d/0e/6d0ef121dcd42915b8086c69c9322a35_1869x890.png) # 参数说明及示例 ## 入口参数 加密字符串:加密过得字符串,示例: `"3df9e122021e353d"` 加密密钥:对待加密字符串加密的密钥,示例: `"123"` ## 出口参数 解密后的字符串:经过解密后的字符串,示例: `__INNER__["result"]`