💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 ``` /** * @category ES加密 * @param instr * 入参|待加密字符串|{@link java.lang.String} * @param key * 入参|加密密钥|{@link java.lang.String} * @param encstr * 出参|加密后的字符串|{@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 = "encstr", 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_des3Enc(String instr, String key) { String strErr = ""; try { Key deskey = null; key += " "; 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.ENCRYPT_MODE, deskey); byte[] by = cipher.doFinal(instr.getBytes()); // EBCD编码 String strRet = ""; for (int i = 0; i < by.length; i++) strRet += Integer.toString(0x200 + by[i], 16).substring(1); return ResultBase.newSuccessResult(strRet); } catch (Exception ex) { AppLog.error(ex); strErr = AppLog.errorMsg(ex); } return ResultBase .newExceptionResult("TPTS0003", "3DES加密出现异常:" + strErr); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/01/7b/017bc1f55df02e6cdd03cc64d5aba3a8_1870x891.png) # 参数说明及示例 ## 入口参数 待加密字符串:需要加密的字符串,示例: `"abc"` 加密密钥:对待加密字符串加密的密钥,示例: `"123"` ## 出口参数 加密后的字符串:经过加密后的字符串,示例: `__INNER__["result"]`