Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OpenSSL::PKey.read that cannot parse PKey in the FIPS mode.
This commit is a workaround to fix this issue below. The `OpenSSL::PKey.read` fails with the OpenSSL 3.0 FIPS mode enabled. ``` $ openssl genrsa -out key.pem 4096 $ ruby -e "require 'openssl'; OpenSSL::PKey.read(File.read('key.pem'))" -e:1:in `read': Could not parse PKey (OpenSSL::PKey::PKeyError) from -e:1:in `<main>' ``` The root cause is that the `OSSL_DECODER_CTX_set_selection` doesn't set the selection value in the life time of the `OSSL_DECODER_CTX` variable in the OpenSSL FIPS mode case. The workaround is to create `OSSL_DECODER_CTX` variable each time, when using the `OSSL_DECODER_CTX_set_selection` to set a different selection value.
- Loading branch information