2

this is my code:

static {
    Security.addProvider(new BouncyCastleProvider());
}

...

final Cipher sifra = Cipher.getInstance("AES/CBC/PKCS7Padding");

Junit works fine but When I deploy my application to weblogic server I got these exception:

java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/CBC/PKCS7Padding

Can you hlp me what is wrong ?

1 Answer 1

2

That's the old strange problem of different versions and missing cryptography files. I believe PKCS5Padding instead of PKCS7Padding will work. Anyway, it has something to do with Unlimited Strength Jurisdiction Policy Files which can be downloaded from Oracle ... or some other missing part or old version of Java Cryptography Extension.

Sign up to request clarification or add additional context in comments.

5 Comments

hm that is nice but I have to use PKCS7 not 5
They are effectively interchangeable for block sizes up to 256. Absolutely the same. But if you must, then the Unlimited Strength Jurisdiction Policy Files are your ticket to ride.
it is a business requirement so I have no choice
ok I add security.provider.N=org.bouncycastle.jce.provider.BouncyCastleProvider to java.security file and now it works thx a lot vdaka :)
Doesn't work for me. I am facing the same issue. the app works all good locally but the error comes out when it runs on a remote Jboss application server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.