2
2 Comments

Cryptography Help (Nodejs)

Howdy!

I'm storing sensitive bank statement transactions in a database and obviously want to ensure the description, amount and balance is kept private and secure.

I'm using knex.js – so using MySQL's inbuilt aes_encrypt function is off the cards as I can't find any documentation on how to do this with Knex.

Ive experimented with Cryptr to encrypt the data before inserting into the DB (using aes-256-gcm)

However; when I read the transactions from the db and loop them them and decrypt - it's slow, noticeably slow.

What would you advise as the best/fastest way to handle this?

on September 5, 2020
  1. 1

    Its better design to encrypt decrypt data at the higher level of stack.
    That way data never goes upto database in plain text over network from app to DB before its encrypted.

    How do make changes when db upgrades throws away encrypted data. lots of hard work.

    I believe this is an opportunity for an API service to encrypt decrypt data.

  2. 1

    I would not do data-at-rest encryption on the application side but on the database side: https://dev.mysql.com/doc/refman/8.0/en/innodb-data-encryption.html