I would like to encrypt certain data before logging it. Currently, I use a private key and a static IV.

Looking at generating a suitable IV I am concerned about the overhead in generating CSPRNG whilst logging. I am sure there is a different way to approach this problem but I do not have the experience to know what is safe. I currently use a Node server on AWS.

What patterns for securing certain properties of logged data are available currently? I don't want to encrypt the whole log as I need to search for properties, but the values need to be hidden.

I would like some direction as to where to find answers or even how to ask the right questions! I am at the stage where I am realising how difficult cryptography is, so thank you for your patience.

  • $\begingroup$ Well implementation isn't hard if you follow some simple rules, but "I use a private key and a static IV". Is this over Node restarts too? $\endgroup$ – Paul Uszak Apr 6 '19 at 11:55
  • $\begingroup$ You could cache IV values and then have a worker thread fill them. The only disadvantage is that you will still have to wait for the first one to be generated if you want to encrypt logs at startup time of your application. Security would not be altered much, IV values may be public after all. You might want to perform some multithreading tests though. $\endgroup$ – Maarten Bodewes Apr 6 '19 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.