Is there a way to verify a signed digest within Postgres?

From: Jonathan Zacharuk <jonathan(dot)zacharuk(at)ascentech(dot)ca>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Is there a way to verify a signed digest within Postgres?
Date: 2017-06-08 17:45:54
Message-ID: YTXPR01MB01749084A69E99E5066B8AD59CC90@YTXPR01MB0174.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The following command was run and the content of content_file, signature_file and id_rsa.pub (or pem) are inserted into a Postgres database.

openssl dgst -sign id_rsa content_file > signature_file

Is there any way to verify that the signature corresponds with the content/public key within Postgres?

I have looked at the pgcrypto<https://www.postgresql.org/docs/current/static/pgcrypto.html> functions however the only relevant function seems to be pgp_pub_decrypt which requires the secret key.

Basically I am looking to perform the following in Postgres:

openssl dgst -verify .\id_rsa.pem -signature .\signature_file .\content_file

I am not married to using the openssl dgst commands, I would also feel comfortable using gpg -sign. I would prefer not to load untrusted libraries (plpythonu etc) or create a C extension if possible.

Thanks, Jon

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-06-08 18:07:13 Re: Performance issue with Pointcloud extension
Previous Message Eric Lemoine 2017-06-08 17:41:17 Re: Performance issue with Pointcloud extension