代码改变世界

c 中openssl aes 加密对应java 方法

public static byte[]  Encrypt(byte[] bArr, byte[] bArr2) {
try {
SecretKey generateSecret = SecretKeyFactory.getInstance("DESede").generateSecret(new DESedeKeySpec(bArr2));
Cipher instance = Cipher.getInstance("DESede/ECB/PKCS5Padding");
instance.init(1, generateSecret);
return instance.doFinal(bArr);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}

posted on 2022-03-25 17:17  Captain林  阅读(111)  评论(0编辑  收藏  举报

导航