Questions tagged [pgcrypto]

The pgcrypto module provides cryptographic functions for PostgreSQL.

The pgcrypto module provides cryptographic functions for PostgreSQL.

102 questions
3
votes
1 answer

Postgres create extension command Docker container

I need to create extensions for a Postgres instance running inside of Docker - specifically postgis. I have followed other SO posts, including this one, to no avail. Here's what I have so far... Dockerfile FROM postgres COPY ext-script.sql…
burntsugar
  • 57,360
  • 21
  • 58
  • 81
3
votes
1 answer

AWS RDS Postgres Crypto functions doesn't work even with the pgcrypto extension enabled

I have the fresh AWS RDS Postgres (v 11) instance. I've installed the pgcrypto extension and it doesn't allow to do that again: CREATE EXTENSION pgcrypto; Error in query (7): ERROR: extension "pgcrypto" already exists But I can't use the extension…
Alexander Pravdin
  • 4,982
  • 3
  • 27
  • 30
3
votes
1 answer

Can't decrypt using pgcrypto from AES-256-CBC but AES-128-CBC is OK

I have problem decrypting data in pgcrypto that was previously encrypted in PHP app. I tried 3 types of encryption: 1) mcrypt - RIJNDAEL 128 CBC 2) mcrypt - RIJNDAEL 256 CBC 3) openssl_encrypt - aes-256-cbc everything is encrypted decrypted fine in…
R A
  • 827
  • 13
  • 25
3
votes
1 answer

Decrypting data (in C#) encrypted by pgcrypto

I'm trying to decrypt data which was encrypted using pgcrypto. I didn't use an IV as it's only a test, but I can't decrypt the data in C#. Encrypting in PostGres: enc_key := '\\xAACE38F289EC3EA209B48D'; -- Time insertions ts_start :=…
Adam Benson
  • 7,480
  • 4
  • 22
  • 45
3
votes
1 answer

PostgreSQL query with function gen_random_uuid() not working on Windows

I have the following query for creating a table, CREATE TABLE IF NOT EXISTS company ( id uuid CONSTRAINT companyid PRIMARY KEY DEFAULT gen_random_uuid(), name varchar(128) NOT NULL, db_uri varchar(255) NOT NULL, c_uri varchar(255)…
AnkitG
  • 305
  • 1
  • 4
  • 15
3
votes
1 answer

postgresql primary key constraint on encrypted data using pgcrypto extension

I am using PostgreSQL 8.4, and using pgp_sym_encrypt function in pgcrypto extension to encrypt data upon insertion. so my insert query would look like: insert into myTable ( column1 ,column2 …
3
votes
1 answer

How to encrypt entire tables using pgcrypto in PostgreSQL

I am looking to store all of my tables in PostgreSQL as aes 256 encrypted (due to client requirements). I will look at decrypting few columns for my analysis later. But apparently the encryption process is a drag as I have loads of tables. I am…
Subha Yoganandan
  • 325
  • 1
  • 6
  • 13
2
votes
2 answers

Calculate x5t#s256 thumbprint of a public certificate present in postgres database using pgcrypto library

I'm working on a module where I'm evaluating method to add thumbprint (x5t#256) value to all public keys present in the DB. Conversion using javascript libraries, java libraries is doable. however trying to convert the same using pgcrypto doesn't…
2
votes
1 answer

Why "PG::UndefinedFunction: ERROR: function gen_random_uuid() does not exist" on new server but not on old?

I have an existing Rails 7 / PostgreSQL app I can run locally and is currently deployed on Heroku. I am migrating it to a VPS running Ubuntu 22 LTS (originally Ubuntu 20 LTS) but when I attempted to run the migrations (directly or via Capistrano)…
Matthew
  • 1,300
  • 12
  • 30
2
votes
1 answer

How to use pgcrypto with prisma

Looking at how to implement hash+salt password storing strategy in NodeJS using bcrypt I found this article, which suggests using native Postgress function pgcrypto. Prisma docs have an example of using pgcrypto only for generating random id, as a…
OlehZiniak
  • 933
  • 1
  • 13
  • 29
2
votes
1 answer

How to use postgres pgcrypto with Nodejs and Sequelize?

How to use sequelize with pgcrypto plugin in postgres. How to encrypt and decrypt the values of a column using sequelize How to use PGP_SYM_ENCRYPT and PGP_SYM_DECRYPT using nodejs and sequelize
Ashutosh Tiwari
  • 1,496
  • 11
  • 20
2
votes
0 answers

Best way to rotate encryption keys in postgresql

We need to encrypt some columns in a postgresql 9.6 database. We are planning to use pgcrytpo's asymmetric key method for our requirement. we keep daily, weekly, monthly and yearly backups using pg_dump. we are planning to rotate encryption keys…
YogeshR
  • 1,606
  • 2
  • 22
  • 43
2
votes
1 answer

Use pgcrypto to verify passwords generated by password_hash

I have password hashes stored in a Postgresql database generated with: password_hash($password, PASSWORD_DEFAULT); Now I would like to also be able to verify a user password with Postgresql and pgcrypto. But pgcrypto's crypt() function is not able…
madflow
  • 7,718
  • 3
  • 39
  • 54
2
votes
1 answer

PostgreSQL10, Pgcrypto, HMAC, how to recalculate data?

I have to make cookies with a Hash created with the HMAC function for automatic authentication. I was searching the internet how to use the HMAC function, and according to what I found, they do it like this: SELECT * FROM APP.USER WHERE ENCODE(…
Luis Vásquez
  • 115
  • 1
  • 1
  • 8
2
votes
1 answer

Django - Annotate and cast an encrypted TextField to a FloatField to 2 decimal places

I'm using Django pgcrypto fields to encrypt an amount value in a model Invoice as follows: from pgcrypto import fields class Invoice(models.Model): # Some other fields amount_usd = fields.TextPGPSymmetricKeyField(default='') objects =…
Mehak
  • 961
  • 9
  • 20