Bug #4418: OpenSSL::PKey::DH#public_key
http://redmine.ruby-lang.org/issues/show/4418
起票者: Ippei Obayashi
ステータス: Open, 優先度: Normal
カテゴリ: ext
ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
OpenSSL::PKey::DH#public_key がその名前に反して DH パラメータのみを複製して返しています。
require ‘openssl’
dh = OpenSSL::PKey::DH.generate(1024) # => パラメータと鍵の生成、時間がかかる
p dh.pub_key # => 公開鍵の整数を表示
p dh.public_key.pub_key # => nil
DH の場合、RSAなどのように「公開鍵とパラメータ」を取り出す需要はあまりない
ように思われるので、名前を変える、もしくはメソッドを廃止するのが良いのではと思われます。
チケット #4418 が更新されました。 (by Martin Bosslet)
ファイル fix_dh_dup.tar.gz 追加
Hi,
I had been doing some work in this area, so I looked into this. The
problem
is that DH parameters are duplicated, but this only duplicates the
generator
g and the prime p, but not the public key, which can be derived from g
and p.
The easiest way to fix this is to simply dup the existing value and
assign it
to the dup’ed DH instance.
Patch and test are attached.
Regards,
Martin
チケット #4418 が更新されました。 (by Ippei Obayashi)
Hi, Martin
Your fix is appropriate.
However, I feel no one needs this (copying only
parameters and a public key) method, so
it is also a reasonable idea that we simply remove
or rename the method.