Issue #4418 has been updated by Ippei Obayashi.

Hi, Martin

RSA#public_key returns a RSA object, DSA#public_key returns a
DSA object, but EC#public_key does not return a EC object (it returns a
EC::Point object).
I feel this fact is also confusing.

Bug #4418: OpenSSL::PKey::DH#public_key

Author: Ippei Obayashi
Status: Assigned
Priority: Normal
Assignee: Hiroshi NAKAMURA
Category: ext
Target version:
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などのように「公開鍵とパラメータ」を取り出す需要はあまりない

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs