[ruby-core:76037] [Ruby trunk Bug#5600][Closed] OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC
From:
k@...
Date:
2016-06-15 14:12:27 UTC
List:
ruby-core #76037
Issue #5600 has been updated by Kazuki Yamaguchi.
Status changed from Assigned to Closed
r55098 (openssl: add OpenSSL::PKey::EC#private? and #public?, 2016-05-21) added OpenSSL::PKey::EC#private?. The code should work now.
Please see also #6567.
----------------------------------------
Bug #5600: OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC
https://bugs.ruby-lang.org/issues/5600#change-59238
* Author: Steve Caligo
* Status: Closed
* Priority: Normal
* Assignee: openssl
* ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
* Backport:
----------------------------------------
Unlike the PKey::DSA and PKey::RSA classes, PKey::EC provides a private_key?() rather than private?() method and is thus incompatible with the other OpenSSL classes that rely on them, i.e. it makes impossible to generate a certificate signing request:
key = OpenSSL::PKey::EC.new('secp521r1')
key.generate_key
req = OpenSSL::X509::Request.new
req.public_key = key
req.subject = OpenSSL::X509::Name.parse('CN=whatever')
req.sign(key, OpenSSL::Digest::SHA384.new)
which produces the error:
in `sign': undefined method `private?' for #<OpenSSL::PKey::EC:0x000000021b4980> (NoMethodError)
ossl_pkey_ec.c should either:
- rb_define_method() the missing private? and public? methods
- rename public_key? to public? and private_key? to private?
Judging by the source code, this should be present in branch 1.8 as well.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>