【发布时间】:2017-05-26 06:35:11
【问题描述】:
我是密码学领域的新手,在这个问题上卡了两天。
我有一个用于 AES/ECB 加密的 java 代码,我希望我的 uwp 应用程序使用相同的加密技术,但到目前为止我尝试过的任何方法都会给出不同的加密结果。
stackoverflow上有很多答案建议使用RijndaelManaged类,但是这个类不适用于UWP。
这里是java sn-p
public string encrypt(String input, string key) {
SecretKeySpec skey = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skey);
crypted = cipher.doFinal(input.getBytes("UTF-8"));
return Base64.encodeToString(crypted,Base64.NO_WRAP);
}
【问题讨论】:
标签: java c# encryption cryptography