From: merch-redmine@jeremyevans.net
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50958] [Ruby master Bug#13100] OpenSSL::PKey::EC#public_keyでGroup情報がコピーされない。
Date: Fri, 11 Sep 2020 20:00:54 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-87536.20200911200054.11707@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-13100.20170104093613.11707@ruby-lang.org>
Issue #13100 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Assigned to Rejected
This is expected and documented behavior since https://github.com/ruby/openssl/commit/9435c8b3cab02a78375cb43e122e4cfc7eee79b9, where `key.group` returns a new group, and modifying that group does not affect the key.
----------------------------------------
Bug #13100: OpenSSL::PKey::EC#public_keyでGroup情報がコピーされない。
https://bugs.ruby-lang.org/issues/13100#change-87536
* Author: azuchi (Shigeyuki Azuchi)
* Status: Rejected
* Priority: Normal
* Assignee: openssl
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
OpenSSL::PKey::EC#public_key= で公開鍵(OpenSSL::PKey::EC::Point)をセットし、その公開鍵のgroupのエンコーディング方式を:compressedにセットした後、OpenSSL::PKey::EC#public_keyで再度公開鍵を取得するとそのgroupのエンコーディング方式が:compressedではなく、:uncompressedのままになります。
2.3.0では:compressedが取得できており、2.4からこの現象が発生します。
OpenSSL::PKey::EC#public_keyで公開鍵を取得する際に、元々のgroupのエンコーディング方式がコピーされてないのではないでしょうか?
以下テストコードです。
~~~
require "test/unit"
class OpenSSL::TestEC < Test::Unit::TestCase
def test_point_conversion_form
pub_key = '03cdd34ec0a05d91c026fe8cb74434923075d3acc20f3f673fb855c8f2c04ca522' # compressed pubkey
key = OpenSSL::PKey::EC.new("secp256k1")
# success 2.4 and 2.3
point = OpenSSL::PKey::EC::Point.new(key.group, OpenSSL::BN.new(pub_key, 16))
point.group.point_conversion_form = :compressed
assert_equal point.group.point_conversion_form, :compressed
# success 2.3, but fail 2.4
key.public_key = OpenSSL::PKey::EC::Point.new(key.group, OpenSSL::BN.new(pub_key, 16))
key.public_key.group.point_conversion_form = :compressed
assert_equal key.public_key.group.point_conversion_form, :compressed
end
end
~~~
--
https://bugs.ruby-lang.org/
parent reply other threads:[~2020-09-11 20:01 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <redmine.issue-13100.20170104093613.11707@ruby-lang.org>]
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-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-87536.20200911200054.11707@ruby-lang.org \
--to=merch-redmine@jeremyevans.net \
--cc=ruby-dev@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 NNTP newsgroup(s).