Using Postgres on Heroku Cedar, when I try to verify a public key using OpenSSL the connection with the database is lost.
# Recreate the error using a Base64 encoded key (BASE64_KEY below) you can go into the console and do the following:
decoded_key = Base64.decode64(BASE64_KEY)
public_key = OpenSSL::PKey::RSA.new(decoded_key)
public_key.verify(OpenSSL::Digest::SHA1.new, "", "")
# Database connection is lost when this fails.
When the verification passes everything is hunky dory. I can’t seem to replicate this behaviour in development.
Any ideas as to why it happens? Even better, is there a work-around?
For anyone coming behind this, I ended up threading the verification process and reading out the result of the thread. This way the database connection of the main thread isn’t lost.
Hardly ideal but it works!