Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unlimited strength cryptography to JRuby Rails template #2251

Closed
donv opened this issue Nov 27, 2014 · 3 comments
Closed

Add unlimited strength cryptography to JRuby Rails template #2251

donv opened this issue Nov 27, 2014 · 3 comments

Comments

@donv
Copy link
Member

donv commented Nov 27, 2014

Rails will not start under JRuby with Java 8 unless you either download and add some JARs from a ZIP (from Oracle) file or add the following initializer:

if RUBY_PLATFORM == 'java' # Allows the application to work with other Rubies if not JRuby
  require 'java'
  java_import 'java.lang.ClassNotFoundException'

  begin
    security_class = java.lang.Class.for_name('javax.crypto.JceSecurity')
    restricted_field = security_class.get_declared_field('isRestricted')
    restricted_field.accessible = true
    restricted_field.set nil, false
  rescue ClassNotFoundException => e
    # Handle Mac Java, etc not having this configuration setting
    $stderr.print "Java told me: #{e}n"
  end
end

Adding the initializer should be done by the JRuby Rails template.

@headius
Copy link
Member

headius commented Apr 22, 2015

I personally would love to do this in JRuby's own bootstrap code, but I have to wonder what sort of trouble we'd get into explicitly routing around the crypto restrictions. DMCA?

@headius
Copy link
Member

headius commented Apr 22, 2015

Well this might answer my question: https://twitter.com/xranby/status/590944882564456448

@enebo I vote we add this hack to our boot logic for both JRuby 1.7 and 9k.

@kares
Copy link
Member

kares commented Sep 6, 2016

JRuby has been handling this for a while now (as well as recently #4101)

@kares kares closed this as completed Sep 6, 2016
@kares kares added this to the Invalid or Duplicate milestone Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants