Skip to content

OpenSSL::PKey::RSA.new without password results in terminal input failure #5588

Closed
jruby/jruby-openssl
#270
@djberg96

Description

@djberg96

Environment

JRuby 9.2.5.0 on a Mac via rbenv:

jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 Java HotSpot(TM) 64-Bit Server VM 9.0.4+11 on 9.0.4+11 +jit [darwin-x86_64]

Darwin Daniels-iMac.attlocal.net 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

I've also seen the same behavior on Linux, and with previous versions of JRuby.

Expected Behavior

When providing a key without a password, it should prompt the user to enter one with "Enter PEM pass phrase". This it does. The user should then be able to type in a password without characters appearing on the screen, and be accepted once the user presses the Enter key.

Actual Behavior

It has two problems. First, when typing, the text is visible. Second, it doesn't appear to accept an "Enter" key, instead I see "^M" characters.

You can reproduce this like so:

require 'openssl'
key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
OpenSSL::PKey::RSA.new(File.read(key))

At that point you'll be prompted to enter your password and you will see the behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions