(Maybe helpful for others with a similar requirement)
I had a similar requirement to use AES-256-CBC
encrypt and decrypt in Java.
To achieve (or specify) the 256-byte encryption/decryption, Java Cryptography Extension (JCE)
policy should set to "Unlimited"
It can be set in the java.security
file under $JAVA_HOME/jre/lib/security
(for JDK) or $JAVA_HOME/lib/security
(for JRE)
crypto.policy=unlimited
Or in the code as
Security.setProperty("crypto.policy", "unlimited");
Java 9 and later versions have this enabled by default.