Tuesday, May 8, 2012

How to install Java Cryptography Extension (JCE) unlimited strength jurisdiction policy files


How to over come "org.apache.xml.security.encryption.XMLEncryptionException: Illegal key size or default parameters" or "java.security.InvalidKeyException:illegal Key Size" error when invoking secured services

These "org.apache.xml.security.encryption.XMLEncryptionException: Illegal key size or default parameters" or "java.security.InvalidKeyException:illegal Key Size" error usually occurs when we try to invoke a web services in a secured manner and your JVM is not provisioned for Java unlimited security jurisdiction.


To provision for the Java unlimited security jurisdiction we have to install Java Cryptography Extension (JCE) unlimited strength jurisdiction policy files.


How to Install JCE

  1. Go to the Oracle Java SE download page http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Scroll down ... Under "Additional Resources" section you will find "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy File"
  3. Download the version that matches your installed JVM E.g. UnlimitedJCEPolicyJDK7.zip
  4. Unzip the downloaded zip 
  5. Copy local_policy.jar and US_export_policy.jar to the $JAVA_HOME/jre/lib/security (Note: these jars will be already there so you have to overwrite them)
  6. Then restart your application to get rid of this exception.

182 comments:

  1. Another solution ist to execute this:

    try {
    Field field = Class.forName("javax.crypto.JceSecurity").
    getDeclaredField("isRestricted");
    field.setAccessible(true);
    field.set(null, java.lang.Boolean.FALSE);
    } catch (Exception ex) {
    ex.printStackTrace();
    }

    ReplyDelete
    Replies
    1. This is just Great! I was so tired to change them at every java update!

      Delete
    2. I am using java version 1.6.0_35, which doesn't have class javax.crypto.JceSecurity. Any equivalent class in 1.6.0_35 jce.jar?

      Many thanks!

      Delete
    3. Many thanks!! It saves me a tremendous time and releases my stress from completing my task on time!

      Thanks Suho fro creating this blob too!!

      Delete
    4. Where do I paste that code?

      Delete
    5. Careful with this Reflection. USA doesn't like exporting high-grade encryption to some countries. Oracle's JCE might have export restrictions. If your code circumvents this in production-code you could cause trouble for yourself

      Delete
  2. Hi Suho..

    Thanks you very much.. It helped me :)

    -Sam

    ReplyDelete
  3. Helped! Much thanks.

    ReplyDelete
  4. So the script works and is running, now what?

    ReplyDelete
  5. Hi, I just wanted to check if java 1.7.x supports JCE ? I am trying to install java with jce. Then after installing jdk should I follow the steps you gave me to finish this task ?

    ReplyDelete
  6. Hi. Thank you very much. It worked!

    ReplyDelete
  7. Hi, thanks for the help but I have another question how do I undo or reverse to the previous version of this thing :P

    ReplyDelete
  8. Download from this link

    http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

    ReplyDelete
  9. Hello! This solution is Excellent!! Thank YOU Suhorish!

    ReplyDelete
  10. Excellent Solution!!!
    Thank You Suhorish!

    ReplyDelete
  11. I download JCE file but one thing I could not figure out how to put local_policy.jar and US_export_policy.jar to the $JAVA_HOME/jre/lib/security. Foremost problem is how to find $JAVA_HOME/jre/lib/security. Please help urgent.

    ReplyDelete
  12. Hi Manoj KC. $JAVA_HOME is nothing but the home directory of your jdk.It is the folder where you installed the jdk.most probably it in in C://Program Files/Java folder.

    ReplyDelete
  13. Thanks a lot, It saved me a lot!!!

    ReplyDelete
  14. Do I put this at the beginning of my encryption code?

    ReplyDelete
  15. Hi Suho, I really need your help. Do I need to restart my machine after adding the new JCE Provider for it to take effect?

    ReplyDelete
  16. Thanks, it's helpful.

    ReplyDelete
  17. Awesome.. I have been trying this for 2-3 days. At last, I could run my program.
    Thanks to you!

    ReplyDelete
  18. I am working in a Digital Signing Server Service. I am looking for the Java code for SHA 512 or RSA, an a DB for public key. Is there that code in the Internet????

    See my Blog blog del Ing. Ernesto Ibáñez

    ReplyDelete
  19. I often get emotionally involved. Like when I read your post, I can cry, laugh, sad, funny, depending on your written words. I think you are a sensitive person.
    baixar facebook l baixar whatsapp l baixar whatsapp l baixar facebook

    ReplyDelete
  20. Thank you for sharing such a nice and interesting blog with us. i have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
    Java Training in Chennai

    ReplyDelete
  21. It is a great article. You will surely like this also because it is a great stufff


    Facebook Lite

    ReplyDelete
  22. Thanks for sharing this information and this is really useful to me. Keep updating this information.
    Java Training in Chennai | Java Training | Java Course in Chennai

    ReplyDelete
  23. Hello!! I'am glad to read the whole content of this blog and am very excited.Thank you.
    gclub casino
    goldenslot casino
    goldenslot

    ReplyDelete
  24. How to ensure that the Java Cryptography Extension has been installed?

    ReplyDelete
  25. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful

    lennyfacetext.com

    ReplyDelete
  26. I like your post. It really useful with me. Thanks for sharing these useful information!
    http://happywheels3game.com

    ReplyDelete
  27. I can feel that the articles contained in this blog is so interesting. I also get a variety informasin, thanks. geometry-dash.net

    ReplyDelete
  28. Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.

    Java Training in chennai

    ReplyDelete
  29. Thanks for the information you shared. Please share useful information with your friends regularly
    papasgamesonline.com

    ReplyDelete
  30. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    www.mcdonaldsgutscheine.net | www.startlr.com | www.saludlimpia.com

    ReplyDelete
  31. I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job! In my free time, I like play game: facebooklite.com.br. What about you?

    ReplyDelete
  32. Great post,Thanks for providing us this great knowledge,Keep it up.
    run3unblockedgame.com

    ReplyDelete
  33. PROMO MERDEKA !!! Bonus 5-10% utk member setia BolaUtama.net Join Now Bocoran SGPnya Jitu 99% ! Proses Depo & WD Tercepat! 1 ID utk Bola,Togel, Casino,Poker Dll

    Silahkan kunjungi situs : Bolautama.com / Bolautama.net ya Bosku ^^

    http://www.cumiblogger.com/2017/08/bolautamacom-agen-piala-eropa-agen-judi.html
    http://www.jakartaviral.com/2017/08/babak-i-watford-dua-kali-robek-gawang.html
    http://www.cumiseo.com/2017/08/bolautamacom-agen-piala-eropa-agen-judi_12.html
    http://bandartogelasli.logdown.com/posts/2159551
    http://biniorang.logdown.com/posts/2159568
    http://masterjudi.logdown.com/posts/2161666
    http://anitasherly.logdown.com/posts/2161703-liga-inggris
    https://vebby2000.wordpress.com/2017/08/13/tim-yang-harganya-lebih-murah-dari-lukaku-pimpin-klasemen-liga-inggris/
    http://menangbandarq.hatenablog.com/entry/2017/08/13/145156
    http://dewihoki.hatenablog.com/entry/2017/08/13/144018
    http://rajahoki.hatenablog.com/entry/2017/08/13/145946

    Liga Inggris
    Agen Judi Bola































    ReplyDelete
  34. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
    b612az.com

    ReplyDelete
  35. Thank you very much for the information you shared, it’s all I’ve been looking for
    www.happywheels-2.com

    ReplyDelete
  36. Thank you, so Much admin have a nice day :) you information about weight loss is very easy and simple.
    pocafashion

    ReplyDelete
  37. I am looking for my memories through the stories, the narrative of people. I feel it is difficult but I will try.
    povaup

    ReplyDelete
  38. I appreciate you and hopping for some more informative posts. thanks for share
    run3.run

    ReplyDelete
  39. I have read your article, the information you give is very interesting.
    pocatravel

    ReplyDelete
  40. Your article is very interesting. I think this article has a lot of information needed, looking forward to your new posts. Get permission to share:
    returnman3game.com

    ReplyDelete
  41. I understand what you bring it very meaningful and useful, thanks.
    instagram viewer images

    ReplyDelete
  42. Your post is interesting. Hope you have more useful posts like this
    vex3.games

    ReplyDelete
  43. Somebody who need windows key click: www.vanskeys.com to got. here i got a working key on my windows about activator. and after i used my windows works properly. hope it help you.

    ReplyDelete
  44. Your post is interesting. Hope you have more useful posts like this

    Android Training Institute in Chennai

    ReplyDelete
  45. Thanks, nice tips

    ReplyDelete
  46. Creating cryptocurrency wallets and the need to mine coins has proved to be a barrier for many people who have wanted to capitalize on the growth in cryptocurrency. FXB Trading has removed those barriers and given access to virtually every cryptocurrency available

    ReplyDelete
  47. very interesting and I really like your article thanks for this very interesting thought hopefully the future will be great :)
    sanadomino

    ReplyDelete
  48. It’s really a great and useful piece of information. I’m glad that you just shared this helpful information with us.
    Please stay us informed like this. Thanks for sharing. ??

    Agen Bola
    Agen Bola Terpercaya
    Poker Online Indonesia
    Poker Online Uang Asli
    Poker Uang Asli
    Agen Poker Online
    Poker Online
    DellPoker
    DellPoker
    PokerGalaxy
    IngatPoker
    Axioobet

    ReplyDelete
  49. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating mulesoft Online Training Hyderabad

    ReplyDelete
  50. Thank you so much. This article helped me a lot in my work.
    Keep posting such informative articles.

    ReplyDelete
  51. terimakasih infonya, silahkan cek website Nonton Movie Online & Nonton Bioskop Online kami.terima kasih

    ReplyDelete
  52. hi here you can play free games

    ReplyDelete
  53. here you can play action games

    ReplyDelete
  54. here you can play free action games

    ReplyDelete
  55. play more free action games here

    ReplyDelete
  56. I have read your blog its very attractive and impressive. I like your blog Java online training Bangalore

    ReplyDelete
  57. Permainan seru ini dapat dimainkan di dalam Hp Android anda dan permainan ini juga sangat cocok menemani luang waktu anda untuk kamu yang baru ingin bergabung dan hanya deposit 20.000ribu saja.
    untuk info lebih lanjut silakan hubungi
    -LIVE CHAT : www,mgmdomino,net
    -BBM D88FDB2E
    -WHATSAPP +85577597038
    KEPUASAN ANDA ADALAH KEBANGGAAN KAMI..!!!
    MGMPOPKER88

    ReplyDelete
  58. lordz io hey if you want to play more action games so click here and get what you want

    ReplyDelete
  59. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    python training in chennai | python course institute in chennai

    ReplyDelete
  60. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    excel advanced excel training in bangalore | Devops Training in Chennai

    ReplyDelete
  61. I was recommended this web site by means of my cousin. I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!
    angularjs Training in marathahalli

    angularjs interview questions and answers

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in chennai

    automation anywhere online Training

    ReplyDelete
  62. I am so proud of you and your efforts and work make me realize that anything can be done with patience and sincerity. Well I am here to say that your work has inspired me without a doubt.
    online Python training
    python training in chennai

    ReplyDelete
  63. The site was so nice, I found out about a lot of great things. I like the way you make your blog posts. Keep up the good work and may you gain success in the long run.
    Python training in bangalore
    Python course in pune
    Python training in bangalore
    python training in chennai
    python course institute in chennai

    ReplyDelete

  64. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.

    AWS Interview Questions And Answers

    AWS Tutorial |Learn Amazon Web Services Tutorials |AWS Tutorial For Beginners


    AWS Online Training | Online AWS Certification Course - Gangboard

    AWS Training in Toronto| Amazon Web Services Training in Toronto, Canada

    ReplyDelete
  65. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information.

    rpa training in chennai
    rpa training in bangalore
    rpa course in bangalore
    best rpa training in bangalore
    rpa online training

    ReplyDelete
  66. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information.

    rpa training in chennai
    rpa training in bangalore
    rpa course in bangalore
    best rpa training in bangalore
    rpa online training

    ReplyDelete
  67. Hi, thanks for sharing such an informative blog. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update.
    datapower tutorial

    ReplyDelete
  68. Hey, wow all the posts are very informative for the people who visit this site. Good work! We also have a Website. Please feel free to visit our site. Thank you for sharing.
    Well written article.Thank You Sharing with Us android code best practices | android development for beginners | future of android development 2018 | android device manager location history

    ReplyDelete
  69. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    python course in pune
    python course in chennai
    python course in Bangalore

    ReplyDelete
  70. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  71. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    excel advanced excel training in bangalore
    Devops Training in Chennai

    ReplyDelete
  72. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    excel advanced excel training in bangalore
    Devops Training in Chennai

    ReplyDelete
  73. Nice blog..! I really loved reading through this article. Thanks for sharing such an amazing post with us and keep blogging... Well written article.Thank You for Sharing with Us Please keep Sharing angular 7 training in chennai | angular 7 training in velachery | Best angular training institute in chennai

    ReplyDelete
  74. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.

    Java training in Chennai | Java training in Tambaram

    Java training in Chennai | Java training in Velachery

    Java training in Chennai | Java training in Omr

    Oracle training in Chennai

    ReplyDelete
  75. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    angularjs Training in bangalore

    angularjs Training in bangalore

    ReplyDelete
  76. Very useful post. The information stated in the article is very practical. The writing style is also easily understandable. Thankyou for sharing..

    big data hadoop online training
    business analytics training online

    ReplyDelete
  77. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Devops interview questions and answers

    ReplyDelete
  78. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    excel advanced excel training in bangalore
    Devops Training in Chennai

    ReplyDelete
  79. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    python course institute in bangalore
    python Course in bangalore
    python training institute in bangalore

    ReplyDelete
  80. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    AWS Training in Chennai |Best Amazon Web Services Training in Chennai
    AWS Training in Rajaji Nagar | Amazon Web Services Training in Rajaji Nagar
    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM

    ReplyDelete
  81. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    AWS Training in Chennai |Best Amazon Web Services Training in Chennai
    AWS Training in Rajaji Nagar | Amazon Web Services Training in Rajaji Nagar
    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM

    ReplyDelete
  82. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
    AWS Training in Bangalore |Best AWS Training Institute in Bangalore BTM, Marathahalli
    AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR

    ReplyDelete
  83. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Advanced AWS Interview Questions And Answers, Top 250+AWS Interviews Questions and Answers 2018
    Advanced AWS Interview questions and answers | Top 110 AWS Interview Question and Answers
    Advanced AWS Training in Bangalore | Best Amazon Web Services Training in Bangalore

    ReplyDelete
  84. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Advanced AWS Interview Questions And Answers, Top 250+AWS Interviews Questions and Answers 2018
    Advanced AWS Interview questions and answers | Top 110 AWS Interview Question and Answers
    Advanced AWS Training in Bangalore | Best Amazon Web Services Training in Bangalore

    ReplyDelete
  85. I always enjoy reading quality articles by an individual who is obviously knowledgeable on their chosen subject. Ill be watching this post with much interest. Keep up the great work, I will be back
    Java training in Chennai | Java training in Omr

    Oracle training in Chennai

    Java training in Chennai | Java training in Annanagar

    Java training in Chennai | Java training institute in Chennai | Java course in Chennai

    ReplyDelete
  86. Really you have done great job,There are may person searching about that now they will find enough resources by your post
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  87. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    online Python training
    python training in chennai

    ReplyDelete
  88. I’m planning to start my blog soon, but I’m a little lost on everything. Would you suggest starting with a free platform like Word Press or go for a paid option? There are so many choices out there that I’m completely confused. Any suggestions? Thanks a lot.
    Best AWS Training in Marathahalli | AWS Training in Marathahalli
    Best AWS Amazon Web Services Training in Chennai | Best AWS Training and Certification for Solution Architect in Chennai

    ReplyDelete
  89. I am so proud of you and your efforts and work make me realize that anything can be done with patience and sincerity. Well I am here to say that your work has inspired me without a doubt.
    angularjs Training in chennai

    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    angularjs-Training in pune

    ReplyDelete
  90. Many thanks!! It saves me a tremendous time and releases my stress from completing my task on time!

    Thanks Suho fro creating this blob too!!

    ReplyDelete
  91. Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

    DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

    Good to learn about DevOps at this time.


    devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

    ReplyDelete
  92. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    best rpa training in chennai
    rpa training in chennai
    rpa interview questions and answers
    automation anywhere interview questions and answers
    blueprism interview questions and answers
    uipath interview questions and answers
    rpa training in bangalore

    ReplyDelete
  93. Thank you so much for this pattern. I found you through ravelry. I am about 1/3 the way through making this. I started right after I started reading your pattern. Thanks again!

    ReplyDelete