codecraig created JRUBY-6636: -------------------------------- Summary: OpenSSL::X509::Certificate and OpenSSL::PKey::RSA constructors don't accept File objects Key: JRUBY-6636 URL: https://jira.codehaus.org/browse/JRUBY-6636 Project: JRuby Issue Type: Bug Components: OpenSSL Affects Versions: JRuby 1.6.5 Environment: Red Hat 5, jruby 1.6.5 (ruby 1.9 mode) Reporter: codecraig Priority: Minor
I opened an issue on [Github|https://github.com/jruby/jruby/issues/152] but wasn't sure which bug tracker is preferred, so I'm putting it here as well. In Ruby (at least 1.9.x) the OpenSSL::X509::Certificate and OpenSSL::PKey::RSA constructors accept a File or String, such as: {code} OpenSSL::X509::Certificate.new File.open("/path/to/my.crt") OpenSSL::X509::Certificate.new File.read("/path/to/my.crt") {code} However, JRuby (at least 1.6.5 and 1.6.7) only accept a String: {code} OpenSSL::X509::Certificate.new File.open("/path/to/my.crt") #=> TypeError: can't convert File into String OpenSSL::X509::Certificate.new File.read("/path/to/my.crt") #=> this works {code} I believe the error created when passing a File to the OpenSSL::X509::Certificate constructor comes from [X509Cert|https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/openssl/X509Cert.java#L144] which in turn calls [OpenSSLImpl|https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/openssl/OpenSSLImpl.java#L60]. -- the call to "arg.toconvertToString" seems to be the problem. I believe the error created when passing a File to the OpenSSL::PKey::RSA constructor comes from [here|https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/openssl/PKeyRSA.java#L185] -- the call to "arg.toconvertToString" seems to be the problem. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email