Getting error when using this algorithm to generate token .
Error :-
org.jose4j.lang.InvalidAlgorithmException: A256KW is an unknown,
unsupported or unavailable alg algorithm (not one of [RSA1_5,
RSA-OAEP, RSA-OAEP-256, dir, A128KW, ECDH-ES, ECDH-ES+A128KW,
PBES2-HS256+A128KW, A128GCMKW]).
So after going deep inside i coded some of the part and got the issue , here was this
I took version,vendor and provider
String version = System.getProperty("java.version");
String vendor = System.getProperty("java.vendor");
String home = System.getProperty("java.home");
String providers = Arrays.toString(Security.getProviders());
LOGGER.info("Initializing jose4j (running with Java {} from {} at {} with {} security providers installed)...", version, vendor, home, providers);
Then i checked that AES256 is it present while initialization of the plugin
WrappingKeyManagementAlgorithm wrappingKeyManagementAlgorithm = new AesKeyWrapManagementAlgorithm.Aes256();
wrappingKeyManagementAlgorithm.getAlgorithmIdentifier();
LOGGER.info("FOR WrappingKeyManagementAlgorithm"+wrappingKeyManagementAlgorithm.isAvailable());
Then again i checked with this code
AlgorithmFactoryFactory factoryFactorys = AlgorithmFactoryFactory.getInstance();
LOGGER.info("FOR JsonWebEncryption"+factoryFactorys.getJweKeyManagementAlgorithmFactory().isAvailable(KeyManagementAlgorithmIdentifiers.A256KW));
So i got to know that java version less than 0_265 does’nt have this support and some of the oracle java with less version you can check with this code.