Java开箱即用地包含AES。Rijndael是AES。您不需要任何外部库。您只需要这样的东西:
byte[] sessionKey = null; //Where you get this from is beyond the scope of this postbyte[] iv = null ; //Dittobyte[] plaintext = null; //Whatever you want to encrypt/decryptCipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//You can use ENCRYPT_MODE or DECRYPT_MODEcipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(sessionKey, "AES"), new IvParameterSpec(iv));byte[] ciphertext = cipher.doFinal(plaintext);就是这样,用于加密/解密。如果要处理大量数据,则最好读取16字节倍数的块,然后调用update而不是doFinal(您只需在最后一个块上调用doFinal)。



