diff options
author | Kazuki Yamaguchi <[email protected]> | 2024-06-14 14:45:56 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2025-01-23 01:45:52 +0900 |
commit | 87316d58faa2d57e9f1c1df2f76584a129a60bcc (patch) | |
tree | 8dfdaf48092519691d7d70e7c04dca1f2cad3c1c /test/openssl/test_pkey_dsa.rb | |
parent | ec4592280fe1efcf65982c2a5c0d39b311d56575 (diff) |
[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::BN https://github.com/ruby/openssl/commit/286934673421[...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.
https://github.com/ruby/openssl/commit/f247ec3dec
Diffstat (limited to 'test/openssl/test_pkey_dsa.rb')
-rw-r--r-- | test/openssl/test_pkey_dsa.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/openssl/test_pkey_dsa.rb b/test/openssl/test_pkey_dsa.rb index a95cce2cf9..e45c3da3e2 100644 --- a/test/openssl/test_pkey_dsa.rb +++ b/test/openssl/test_pkey_dsa.rb @@ -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 |