You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static String aesEncrypt(String data, String key) {
try {
String spec = key.substring(0, 16);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding");
IvParameterSpec iv = new IvParameterSpec(spec.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
byte[] bytes = cipher.doFinal(data.getBytes("UTF-8"));
return new String(Base64.encode(bytes));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
有没有能解决这样的加解密的例子?
Are there any examples of encryption and decryption that can be solved?
我找了很久都没有找一个能解决问题的例子
I've been looking for a long time without finding an example to solve the problem
public static String aesEncrypt(String data, String key) {
try {
}
有没有能解决这样的加解密的例子?
Are there any examples of encryption and decryption that can be solved?
我找了很久都没有找一个能解决问题的例子
I've been looking for a long time without finding an example to solve the problem