Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES"); cipher.init(Cipher.ENCRYPT_MODE, keySpec);
byte[] encryptedData = cipher.doFinal(plainTextBytes);In this example, plainTextBytes is the data to be encrypted, and encryptedData is the resulting encrypted data. The javax.crypto package is part of the Java Cryptography Extension (JCE), which provides additional cryptographic algorithms and services for Java.