diff options
author | Kazuki Yamaguchi <[email protected]> | 2021-02-25 16:49:11 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2021-03-16 19:37:06 +0900 |
commit | e35d3623de47b1a8d699f431460fbcba36de84f2 (patch) | |
tree | ea4c2e2e6a9911e52b9ba16a2efd58e5259ba7d8 /sample/openssl/cert2text.rb | |
parent | a3f97007bbd1012a4b7662b8166118b81b52527a (diff) |
[ruby/openssl] sample: avoid "include OpenSSL"
It is not a common practice and should not be done since it causes name
clash: for example, Digest and Random are provided by other standard
libraries of Ruby.
Fixes: https://github.com/ruby/openssl/issues/419
https://github.com/ruby/openssl/commit/6a6444984b
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4275
Diffstat (limited to 'sample/openssl/cert2text.rb')
-rw-r--r-- | sample/openssl/cert2text.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sample/openssl/cert2text.rb b/sample/openssl/cert2text.rb index 50da224e76..fe14e51d3a 100644 --- a/sample/openssl/cert2text.rb +++ b/sample/openssl/cert2text.rb @@ -1,10 +1,13 @@ #!/usr/bin/env ruby require 'openssl' -include OpenSSL::X509 def cert2text(cert_str) - [Certificate, CRL, Request].each do |klass| + [ + OpenSSL::X509::Certificate, + OpenSSL::X509::CRL, + OpenSSL::X509::Request, + ].each do |klass| begin puts klass.new(cert_str).to_text return |