Author: lukaszwojtow Posted: Friday, September 23, 2022

Ask HN: How to Ensure Correct Encryption?

Hi, I'm writing my own encryption/decryption tool as an exercise. I'm using separate, audited RSA library for actual encryption but everything else is on me. On my machine I have some ordinary RAM (not ECC) and a file system without error correction. So I'm trying to think what can go wrong: 1. A key gets corrupted in memory (through cosmic ray or memory error). 2. A key can be read from the disk with error. 3. File can be saved with an error.

My ideas to solve it: Ad 1. Have two keys in memory and compare them before encrypting each file. Ad 2. Some sort of checksum (I assume that public key has no such thing). Ad 3. The only thing I can think of: after encryption compare with "valid" (probably encrypt again and compare).

Can you think of anything else?

4
Read on Hacker News Comments 1