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

Method decrypt

security/src/main/java/pro/tools/security/ToolPBE.java:142–157  ·  view source on GitHub ↗

解密 @param data 数据 @param password 密码 @param salt 盐 @return byte[] 解密数据 @throws Exception

(byte[] data, String password, byte[] salt)

Source from the content-addressed store, hash-verified

140 * @throws Exception
141 */
142 public static byte[] decrypt(byte[] data, String password, byte[] salt) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
143 // 转换密钥
144 Key key = toKey(password);
145
146 // 实例化PBE参数材料
147 PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 100);
148
149 // 实例化
150 Cipher cipher = Cipher.getInstance(ALGORITHM);
151
152 // 初始化
153 cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
154
155 // 执行操作
156 return cipher.doFinal(data);
157 }
158
159}

Callers

nothing calls this directly

Calls 3

toKeyMethod · 0.95
getInstanceMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected