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

Method decrypt

security/src/main/java/pro/tools/security/ToolDES.java:76–89  ·  view source on GitHub ↗

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

(byte[] data, byte[] key)

Source from the content-addressed store, hash-verified

74 * @throws Exception
75 */
76 public static byte[] decrypt(byte[] data, byte[] key) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException, NoSuchPaddingException, BadPaddingException, IllegalBlockSizeException {
77
78 // 还原密钥
79 Key k = toKey(key);
80
81 // 实例化
82 Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
83
84 // 初始化,设置为解密模式
85 cipher.init(Cipher.DECRYPT_MODE, k);
86
87 // 执行操作
88 return cipher.doFinal(data);
89 }
90
91 /**
92 * 加密

Callers

nothing calls this directly

Calls 3

toKeyMethod · 0.95
getInstanceMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected