The code below works, but it works only at 128 bits. I'm not failing because of the JCE's lack of support for high-rate encryption (I've taken care of this), but I'm looking for a way to support a non-default key rate.
def encrypt(iv4bytes: Array[Byte], pass: String, indata: Array[Byte]): Array[Byte] = {
val cipher = Cipher.getInstance("AES/CBC/NoPadding", "SunJCE") // Get a cipher object
val key = new SecretKeySpec(pass.getBytes("UTF-8"), "AES") // Get our key object
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv4bytes)) // Initialize crypto
return cipher.doFinal(indata) // And do the encryption
}