Skip to content

Commit

Permalink
Fix: Ensure unique IV generation for GCM encryption to prevent reuse …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
AssahBismarkabah committed Aug 5, 2024
1 parent ea27fc6 commit 843063c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.OutputStream;
import java.security.Key;
import java.security.KeyPair;
import java.security.SecureRandom;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -145,7 +146,7 @@ private OutputStream streamEncrypt(OutputStream dataContentStream, Set<Recipient

return generator.open(
dataContentStream,
new JceCMSContentEncryptorBuilder(algorithm).setProvider(GeneratorModule_ProviderFactory.provider()).build()
new JceCMSContentEncryptorBuilder(algorithm).setProvider(GeneratorModule_ProviderFactory.provider()).setSecureRandom(new SecureRandom()).build()
);
}
}

0 comments on commit 843063c

Please sign in to comment.