Reputation: 21473
I have a Java app that requires JCE Unlimited Strength policy files to be installed in order to generate certificates. However, currently, the system fails silently if the files are not installed, rather than throwing an exception or something.
Is there a programmatic way to check for these files from within the app? thanks.
Upvotes: 2
Views: 398
Reputation: 21473
Turns out, as GregS points out above, that the program was not failing silently, but swallowing the exception. The call to KeyStore.store()
was throwing an IOException
that I was catching with a generic catch (Exception e)
farther below. Once catching the IOException
separately, the program now works properly.
Upvotes: 1
Reputation: 328669
Probably not the cleanest way:
If it is not there your application should throw an Exception, so you could try a small encryption test that is supposed to work and catch that exception. That's what I do with Bounty Castle.
I suppose you could also check the installed libraries (it looks like the Manisfest within the JAR files contains the strength).
Upvotes: 2