ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@googlemail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:45540] [ruby-trunk - Bug #5600] OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC
Date: Sun, 10 Jun 2012 09:29:23 +0900	[thread overview]
Message-ID: <redmine.journal-27135.20120610092923@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-5600.20111109023655@ruby-lang.org


Issue #5600 has been updated by MartinBosslet (Martin Bosslet).


Unfortunately it's not done by simply renaming the methods appropriately. It still would fail because OpenSSL::PKey::EC#public_key returns an OpenSSL::PKey::EC::Point instead of another OpenSSL::PKey::EC, and as a consequence, there's no reference to an EVP_PKEY that is needed internally. The whole EC interface needs an overhaul. I'll set up a parent task referencing all the issues that piled up since the release of 1.9.3. The goal would be to make EC follow the general PKey interface, allowing to use them interchangeably wherever a PKey instance is expected.
----------------------------------------
Bug #5600: OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC
https://bugs.ruby-lang.org/issues/5600#change-27135

Author: scaligo (Steve Caligo)
Status: Assigned
Priority: Normal
Assignee: MartinBosslet (Martin Bosslet)
Category: ext
Target version: 2.0.0
ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]


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.



-- 
http://bugs.ruby-lang.org/

  parent reply	other threads:[~2012-06-10  0:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 17:36 [ruby-core:40853] [ruby-trunk - Bug #5600][Open] OpenSSL::X509::Request can't sign() an OpenSSL::PKey::EC Steve Caligo
2011-11-08 17:47 ` [ruby-core:40854] [ruby-trunk - Bug #5600][Assigned] " Martin Bosslet
2012-06-10  0:29 ` MartinBosslet (Martin Bosslet) [this message]
2013-02-18 12:23 ` [ruby-core:52444] [ruby-trunk - Bug #5600] OpenSSL::X509::Request can&#x27;t " mame (Yusuke Endoh)
2015-06-30  3:38 ` [ruby-core:69792] [Ruby trunk - Bug #5600] OpenSSL::X509::Request can't " adam
2015-09-13  3:19 ` [ruby-core:70768] " zzak
2016-06-15 14:12 ` [ruby-core:76037] [Ruby trunk Bug#5600][Closed] " k

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-27135.20120610092923@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).