PostgreSQL Client Certificate TLS error PostgreSQL 9.4.6
OpenSSL 1.0.2f


If my server or client certificate use SHA256, I get the following error on the client:

psql: SSL error: tlsv1 alert decrypt error


And the following log message on the server:

LOG:  could not accept SSL connection: unknown message digest algorithm


If I generate the client key with SHA1, it works fine:

openssl x509 -req -in user.csr -CA root.crt -CAkey server.key -out user.crt -CAcreateserial -days 365 -sha1


How can I get it to work with SHA256?
This can happen if PostgreSQL is compiled against an older version of openssl than the version used to generate the keys.

Recompiling with the correct openssl library fixes the problem.