首页 > TAG信息列表 > aes-gcm

Android:在Android中使用GCM模式进行AES加密和解密?

我正在尝试加密&使用AES算法和字符串解密字符串GCM模式. 我的代码能够加密字符串,但是我无法解密编码的数据. 遵循的步骤: >创建密钥() >加密(字符串)>解密(encded_data); 我的代码: 建立金钥 public void createKey() { try { if (!ks.containsAlias(keyName)) {

java-AES / GCM / NoPadding AEADBadTagException

我正在尝试使用AES / GCM / NoPadding在Java8中进行加密.但是我不知道为什么解密时会出现AEADBadTagException. 这是我的代码: private final int GCM_IV_LENGTH = 12; private final int GCM_TAG_LENGTH = 16; private static String encrypt(String privateString, SecretKey sk

java – GCMParameterSpec抛出InvalidAlgorithmParameterException:未知参数类型

我正在做android数据加密以保存在SharedPreferences中. GCMParameterSpec是在API 19中的Android中引入的,我用它来进行AES / GCM / NoPadding加密.这就是我实现它的方式: Cipher c = Cipher.getInstance("AES/GCM/NoPadding"); c.init(Cipher.ENCRYPT_MODE, getSecretKey(context),

java – BouncyCastle GCM / CCM ArrayIndexOutOfBoundsException

任何人都可以举个例子,在BouncyCastle中使用带有AES的GCM和/或CCM模式吗?我的代码是这样的: SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); IvParameterSpec ivSpec = new IvParameterSpec(ivBytes); Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding

在Android上向AES-GCM添加​​其他经过身份验证的数据

我正在尝试将其他经过身份验证的数据(AAD)添加到Android上的AES-GCM.我看到Cipher notes的Java 7版本关于使用GCMParameterSpec和updateAAD(…)方法,但鉴于Android是基于Java 6的,我完全没有想法.我正在使用Spongycastle作为加密库 GCMParameterSpec s = new GCMParameterSpec(.