mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
[ruby/openssl] pkey: change PKey::{RSA,DSA,DH}#params to use nil for missing parameters
The returned Hash from these methods contain 0 in place of a missing parameter in the key, for example: pkey = OpenSSL::PKey.read(OpenSSL::PKey::RSA.new(2048).public_to_pem) pp pkey.params #=> # {"n"=>#<OpenSSL::BN2869346734
[...snip]>, # "e"=>#<OpenSSL::BN 65537>, # "d"=>#<OpenSSL::BN 0>, # "p"=>#<OpenSSL::BN 0>, # "q"=>#<OpenSSL::BN 0>, # "dmp1"=>#<OpenSSL::BN 0>, # "dmq1"=>#<OpenSSL::BN 0>, # "iqmp"=>#<OpenSSL::BN 0>} Let's use nil instead, which is more appropriate for indicating a missing value.f247ec3dec
This commit is contained in:
parent
ec4592280f
commit
87316d58fa
4 changed files with 7 additions and 7 deletions
|
@ -248,7 +248,7 @@ fWLOqqkzFeRrYMDzUpl36XktY6Yq8EJYlW9pCMmBVNy/dQ==
|
|||
assert_equal(key.pub_key, pubkey.pub_key)
|
||||
assert_equal(key.pub_key, pubkey.params["pub_key"])
|
||||
assert_nil(pubkey.priv_key)
|
||||
assert_equal(0, pubkey.params["priv_key"])
|
||||
assert_nil(pubkey.params["priv_key"])
|
||||
end
|
||||
|
||||
def test_dup
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue