Help with OpenSSL::PKey::PKeyError in AccessTokensController#create

Help with OpenSSL::PKey::PKeyError in AccessTokensController#create

I'm trying to configure an RI platform and RI tool. I followed the steps here:

Now I got stuck at the very end, in step 25. When I click on "Perform Launch" (step 24 in the instructions) I get "JSON::ParserError in Lti::LaunchesController#show". The error page contains a big wall of HTML text. So decided to load that HTML in a separate browser tab. That renders into another error page, titled: "OpenSSL::PKey::PKeyError in AccessTokensController#create".

Based on the error, I'm guessing it has something to do with public key or private key somewhere. But I'm not sure how to debug this. Any help in resolving this is appreciated. Thanks.

Additional information on the issue above

When the platform was configured to use tool's JWT Key Set URL, the said error occurs. Later I edited the platform to use the tool's public key, now I can see successful launches. This leads me to think there was something wrong with how the keyset URL prepares it's response or the response is being parsed.