4wlvjq
Last Updated: February 25, 2016
·
2.124K
· irio
10854894 10205791094399722 8482751710585104962 o

Fix for OpenSSL::Cipher::CipherError in Rails 4 with JRuby

OpenSSL::Cipher::CipherError in DealsController#index

Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE

Rails.root: /Users/irio/Code/gardener
Application Trace | Framework Trace | Full Trace

org/jruby/ext/openssl/Cipher.java:700:in `update'

There's already a wiki page in JRuby project reporting the why's: https://github.com/jruby/jruby/wiki/UnlimitedStrengthCrypto

Let's see the how.

  1. Download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
  2. Unzip it.
  3. Find folders where policy files are located (see below).
  4. Backup current policies (*.jar files).
  5. Copy unzipped local_policy.jar and US_export_policy.jar to the listed folders, replacing the existent ones.

Restart your Rails app and enjoy it working again.

$ cd /Library/Java/JavaVirtualMachines
$ find . -name 'local_policy.jar'
./jdk1.8.0_40.jdk/Contents/Home/jre/lib/security/local_policy.jar
Say Thanks
Respond