I have sensitive logs that needs to be encrypted using AES-256 and RSA. Due to the nature of the logging system, the entries (rows) need to be encrypted one-by-one.

My approach was to reuse the same AES-256 key and IV (and also the same RSA pubkey) per run of the application. I would save the unencrypted IV and the RSA encrypted AES key together with each log entry. I figured out that this is not secure as two identical log entries in the same application run would yield the same cipher text, making inference possible (please correct me if this is not true).

What I'm thinking of now is encrypting each log entry using the same AES key but with different IVs . This will remove the need to perform the expensive RSA encryption for each log entry, while not allowing inference weakness. Is this approach secure?

  • 2
    $\begingroup$ Indeed, that's the purpose of IV - it allows us to reuse the key. The IV must be unique (for some modes the IV must be unpredictable) $\endgroup$ – gusto2 Jan 11 '18 at 8:48

Yes that would work; that's exactly what the IV is for. In this case the IV is really required to obtain confidentiality over multiple log entries. Note that public key operations are relatively fast for RSA (but nowhere near so fast as AES encryption, generally).

Mind though that there are many other possible leaks of information: size of ciphertext, time of logging, change of encrypted AES key (i.e. change of run). If those leak any info depends on you.

Also note that encryption by itself does not allow to detect change, duplication, removal etc. So you should make sure that this is acceptable to you as well. Signatures generation and sequence numbers can be part of a solution to create a cryptographically secured, auditable log file.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.