OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC
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')
req = OpenSSL::X509::Request.new
req.public_key = key
req.subject = OpenSSL::X509::Name.parse('CN=whatever')
which produces the error:
sign': undefined methodprivate?' 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.