1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/openssl
Kazuki Yamaguchi a01daab656 [ruby/openssl] x509, ssl, pkcs7: try to parse as DER-encoding first
Methods that take both PEM-encoding and DER-encoding have not been
consistent in the order in which encoding to attempt to parse.

A DER-encoding may contain a valid PEM block ("\n-----BEGIN ..-----" to
"-----END ...-----") embedded within it. Also, the PEM-encoding parser
allows arbitrary data around the PEM block and silently skips it. As a
result, attempting to parse data in DER-encoding as PEM-encoding first
can incorrectly finds the embedded PEM block instead.

This commit ensures that DER encoding will always be attempted before
PEM encoding. OpenSSL::X509::Certificate is one of the updated classes.
With this, the following will always be true:

    # obj is an OpenSSL::X509::Certificate
    obj == OpenSSL::X509::Certificate.new(obj.to_der)
    obj == OpenSSL::X509::Certificate.new(obj.to_pem)

https://github.com/ruby/openssl/commit/b280eb1fd0
2021-07-18 17:44:54 +09:00
..
fixtures/pkey
test_asn1.rb [ruby/openssl] require OpenSSL >= 1.0.2 and LibreSSL >= 3.1 2021-07-18 17:44:41 +09:00
test_bn.rb [ruby/openssl] BN.abs and BN uplus 2021-07-18 17:44:39 +09:00
test_buffering.rb
test_cipher.rb
test_config.rb
test_digest.rb
test_engine.rb
test_fips.rb
test_hmac.rb
test_kdf.rb
test_ns_spki.rb
test_ocsp.rb [ruby/openssl] require OpenSSL >= 1.0.2 and LibreSSL >= 3.1 2021-07-18 17:44:41 +09:00
test_ossl.rb
test_pair.rb
test_pkcs7.rb
test_pkcs12.rb
test_pkey.rb [ruby/openssl] pkey: implement #to_text using EVP API 2021-07-18 17:44:50 +09:00
test_pkey_dh.rb [ruby/openssl] pkey/dh, pkey/ec: use EVP_PKEY_check() family 2021-07-18 17:44:52 +09:00
test_pkey_dsa.rb [ruby/openssl] pkey/dsa: use high level EVP interface to generate parameters and keys 2021-07-18 17:44:49 +09:00
test_pkey_ec.rb
test_pkey_rsa.rb [ruby/openssl] pkey: implement {DH,DSA,RSA}#public_key in Ruby 2021-07-18 17:44:51 +09:00
test_random.rb
test_ssl.rb [ruby/openssl] Add SSLSocket#getbyte 2021-07-18 17:44:53 +09:00
test_ssl_session.rb
test_ts.rb
test_x509attr.rb
test_x509cert.rb [ruby/openssl] x509, ssl, pkcs7: try to parse as DER-encoding first 2021-07-18 17:44:54 +09:00
test_x509crl.rb
test_x509ext.rb
test_x509name.rb
test_x509req.rb
test_x509store.rb
ut_eof.rb [ruby/openssl] Add SSLSocket#getbyte 2021-07-18 17:44:53 +09:00
utils.rb