diff options
author | Kazuki Yamaguchi <[email protected]> | 2020-05-17 18:25:38 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2021-07-18 17:44:50 +0900 |
commit | 5d1693aac56bcae37e1f81af1f25966269c4619a (patch) | |
tree | 5f9ec4d495eb71fa9abeb5861db65b78b8073d45 /test | |
parent | 436aecb520e63f318ed515d0ca6c0b2cc6cc8115 (diff) |
[ruby/openssl] pkey: implement #to_text using EVP API
Use EVP_PKEY_print_private() instead of the low-level API *_print()
functions, such as RSA_print().
EVP_PKEY_print_*() family was added in OpenSSL 1.0.0.
Note that it falls back to EVP_PKEY_print_public() and
EVP_PKEY_print_params() as necessary. This is required for EVP_PKEY_DH
type for which _private() fails if the private component is not set in
the pkey object.
Since the new API works in the same way for all key types, we now
implement #to_text in the base class OpenSSL::PKey::PKey rather than in
each subclass.
https://github.com/ruby/openssl/commit/e0b4c56956
Diffstat (limited to 'test')
-rw-r--r-- | test/openssl/test_pkey.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/openssl/test_pkey.rb b/test/openssl/test_pkey.rb index 0a516f98e8..4a539d8c46 100644 --- a/test/openssl/test_pkey.rb +++ b/test/openssl/test_pkey.rb @@ -169,4 +169,9 @@ class OpenSSL::TestPKey < OpenSSL::PKeyTestCase key1.compare?(key4) end end + + def test_to_text + rsa = Fixtures.pkey("rsa1024") + assert_include rsa.to_text, "publicExponent" + end end |