Questions tagged [pgcrypto]

The pgcrypto module provides cryptographic functions for PostgreSQL.

The pgcrypto module provides cryptographic functions for PostgreSQL.

102 questions
2
votes
1 answer

Pgcrypto commands produce non-standard output

Each time i run 'encrypt' or 'digest' commands my output contains multiple instances of character '\'. See example "select encrypt('123456789012345','1234','aes');" - expected output: "\x34591627f9c8eae417fc7cbbf458592c" whereas my output is as…
Greg Rowles
  • 191
  • 2
  • 11
2
votes
1 answer

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

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…
jzacharuk
  • 2,058
  • 1
  • 16
  • 22
2
votes
1 answer

Postgresql Error: Corrupt ascii-armor

I am using PostgreSQL 9.3.5 and trying to encrypt data using pgp_pub_encrypt() offered by pgcrypto extension. Running SELECT pgp_pub_encrypt('Vipin', dearmor('gpg_public_key')) throws an error Corrupt ascii-armor. Please help. I am using
Vipin Nagpal
  • 143
  • 1
  • 3
  • 12
2
votes
1 answer

Encrypt the datas in postgresql

I am beginner in PostgreSQL. Right now, I am using PostgreSQL 9.3 Version installed in Windows Server 2008 OS. I am planing to encrypt the data in user table. I have go through most of the web sites related that, but I did not get clear idea and…
2
votes
1 answer

How should column-level PostgresSQL encryption implemented in SQLAlchemy using pgcrypt?

For example, there is a repo for doing this in Django: https://sourcegraph.com/github.com/dcwatson/django-pgcrypto. There is some discussion in the SQLAlchemy manual, but I am using non-byte columns:…
Soferio
  • 483
  • 6
  • 14
1
vote
1 answer

Is there a MariaDB equivalent of pgp_sym_encrypt from pgcrypto for Postgres?

I've been tasked with migrating a Postgres 13 database to MariaDB. The existing Postgres database uses pgp_sym_encrypt to encrypt certain values of data when inserting: insert into a_table ( normal_value, secret_value ) values ( 'normal', …
DJDaveMark
  • 2,669
  • 23
  • 35
1
vote
0 answers

How to use pgcrypto `crypt` function with Go's (*sql.Tx).Exec function?

I would like to be able to use the encryption provided by the PostgreSQL extension pgcrypto from within my go program. Consider this code snippet: _, err = tx.Exec("INSERT INTO users (username, email, password) VALUES (?, ?, crypt(?, gen_salt('bf',…
nwtnsqrd
  • 65
  • 4
1
vote
1 answer

Add custom database session variable to Spring Boot JPA queries?

I am trying to set SET SESSION encrypt.key='some_key' to database queries or connection. Thing is I have following column definition in my model class @ColumnTransformer(forColumn = "first_name", read = "pgp_sym_decrypt(first_name,…
Aditya T
  • 1,566
  • 2
  • 13
  • 26
1
vote
0 answers

Postgresql decrypting data encrypted on C#

So, I'm trying to decrypt a data on Postgres that was encrypted on C#. On both sides I'm trying to have the same specification: Algorithm: DES Mode: ECB Padding: PKCS Key: md5 hashed bytes from string Well, I couldn't find on Postgres docs…
Andrew Paes
  • 1,940
  • 1
  • 15
  • 20
1
vote
0 answers

How to decrypt a code-side encoded text field with AES / CBC / PKCS5Padding cipher in POSTGRESQL?

I have a decryption problem on a text attribute encoded with java code configured as follows: private static final String CIPHER_INSTANCE_NAME = "AES/CBC/PKCS5Padding"; private static final String SECRET_KEY_ALGORITHM = "AES"; public Cipher…
1
vote
1 answer

Client Side Encryption with Java and Postgres Database

I've done quite a bit of digging and research on implementations of client side per-tenant encryption but am a bit stumped on how I should proceed with our application. For some background we've got a dropwizard application that has many custom DAOs…
jban
  • 23
  • 4
1
vote
1 answer

Encryption in postgres using pgcrypto module and Decryption in java

I have created a trigger and a trigger function which invokes on every update operation on a table and encrypts a specific value as below: create trigger project_trigger before update on projects for each row execute procedure…
Gadhia Reema
  • 186
  • 3
  • 17
1
vote
1 answer

Decrypting AES GCM 256 with pgcrypto (PostgresQL)

I am trying to decrypt a message with pgcrypto that is encrypted with AES GCM 256. Specifications of the encryption: Encryption algorithm AES Key [secret of listener] (64-character-long hexadecimal string in…
Chris Rutte
  • 173
  • 1
  • 14
1
vote
1 answer

pgcrypto: unable to normal user

I need to enable pgcrypto on a postgresql 12 instance. I enabled the extension and checked it was ok: postgres=# CREATE EXTENSION pgcrypto; CREATE EXTENSION postgres=# SELECT digest('blah', 'sha256'); …
1
vote
0 answers

postgresql encrypt with symmetric key and rolling it

i want to encrypt data inside a table in postgresql, i may encrypt a few column or all column data in that table. if i do query directly from sql client (DBeaver, Adminer) then i can retrieve the column value but it's not readable (because it's…
cumibulat
  • 434
  • 3
  • 6
  • 22