* [ruby-dev:50958] [Ruby master Bug#13100] OpenSSL::PKey::EC#public_keyでGroup情報がコピーされない。
[not found] <redmine.issue-13100.20170104093613.11707@ruby-lang.org>
@ 2020-09-11 20:00 ` merch-redmine
0 siblings, 0 replies; only message in thread
From: merch-redmine @ 2020-09-11 20:00 UTC (permalink / raw)
To: ruby-dev
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-11 20:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-13100.20170104093613.11707@ruby-lang.org>
2020-09-11 20:00 ` [ruby-dev:50958] [Ruby master Bug#13100] OpenSSL::PKey::EC#public_keyでGroup情報がコピーされない。 merch-redmine
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).