求解 java aes 转C# aes
public static byte[] encrypt(String content, String password) {
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES", "BC");
kgen.init(128);
SecretKeySpec key = new SecretKeySpec(password.getBytes("utf-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC");// 创建密码器
byte[] byteContent = content.getBytes("GBK");
cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
byte[] result = cipher.doFinal(byteContent);
return result; // 加密
} catch (Exception e) {
}
return null;
}

浙公网安备 33010602011771号