求解 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;
}

posted @ 2017-09-05 12:57  DCworker  阅读(274)  评论(1)    收藏  举报