MCPcopy Create free account
hub / github.com/SeanDragon/protools / decrypt

Method decrypt

security/src/main/java/pro/tools/security/ToolDH.java:185–196  ·  view source on GitHub ↗

解密 @param data 待解密数据 @param key 密钥 @return byte[] 解密数据 @throws Exception

(byte[] data, byte[] key)

Source from the content-addressed store, hash-verified

183 * @throws Exception
184 */
185 public static byte[] decrypt(byte[] data, byte[] key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
186
187 // 生成本地密钥
188 SecretKey secretKey = new SecretKeySpec(key, SECRET_KEY_ALGORITHM);
189
190 // 数据解密
191 Cipher cipher = Cipher.getInstance(secretKey.getAlgorithm());
192
193 cipher.init(Cipher.DECRYPT_MODE, secretKey);
194
195 return cipher.doFinal(data);
196 }
197
198 /**
199 * 构建密钥

Callers

nothing calls this directly

Calls 2

getInstanceMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected