Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extremely slow encryption on Linux #4

Open
dasFlug opened this issue Mar 31, 2019 · 0 comments
Open

Extremely slow encryption on Linux #4

dasFlug opened this issue Mar 31, 2019 · 0 comments

Comments

@dasFlug
Copy link

dasFlug commented Mar 31, 2019

I got performance issue with DICOM objects anonymization. Setup should process relatively large load about thousand studies per hour. DICOM values encryption used and CTP running on Linux computer. Processing time down to minutes per study after some small amount of studies processed with good performance. Issue is Linux specific and can't be reproduced on Windows computer.
I found the issue reason after application profiling. Encryption calls getCipher method from org.rsna.util.CipherUtil for each value need to be encrypted and getCipher method obtains SecureRandom

SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
byte[] seed = random.generateSeed(8);
random.setSeed(seed);

Default SecureRandom implementation on Linux uses /dev/random and may block program until enough entropy will be collected in /dev/random to generate next strong random value. This process may get tens of seconds. Workaround is switch implementation to use less secure but faster /dev/urandom by java properties.
However SecureRandom generation may be removed from getCipher method because
SecureRandom not required for Blowfish cipher and third parameter in
cipher.init(mode, skeySpec, random);
call ignored.

I did this fix locally and it working well. I can submit it if you would like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant