Have you ever met this Exception like "Cryptography - JCE cannot authenticate provider BC"? and by now you don't know how to deal with it? If you all say "yes", Congratulations! Your have came the right place.
Follow me, i will give you the answer and tell you why should do like this.
Solution
1. DownLoad BC
You can download this lib form www.bouncycastle.org, type and version should choose by your current case, here i will choose java and which lastest java releases -- bcprov-jdk16-143.jar.
2. Deploy BC to JRE/JDK
Copy this lib to your JRE/JDK base lib directory, for example
as to me, which like:
XP:
C:\Program Files\Java\jre1.6.0_07\lib\ext
Debin:
/usr/local/jre1.6.0_14/lib/ext
If you need, you can deploy them to JDK's dir, just as you wish.
3.Set JCE Security Provider
Open "java.security" and set the BC provider.
Directory like:
XP:
C:\Program Files\Java\jre1.6.0_07\lib\security
Debin:
/usr/local/jre1.6.0_14/lib/security
And add the BC provider
security.provider.2=org.bouncycastle.jce.provider.BouncyCastleProvider
Now, That all of BC part.
Addition
As to Java, if you want to use Long key, now you should get the support be JCE, version should fit to your JDK/JRE. More see my another aritcle "Chapter One:Install EJBCA "
本文转自danni505 51CTO博客,原文链接:http://blog.51cto.com/danni505/175688,如需转载请自行联系原作者