15
Dec
04

java.security.KeyStore.getKey() can be expensive

We were looking at some code today that pulls some encrypted information from a database and decrypts it, considering strategies to improve performance. Currently, when a certain report is run, it brings the system to its knees, pulling out each row and decrypting it.

Some tests led to the clear conclusion that the bottleneck had little to do with computing the encryption algorithm, and far more to do with a single line of code, that grabbed the SecretKey from the KeyStore. Changing the code to cache this key led to performance improvements of 1500%-3000%, depending on sample size. Performance was generally comparable whether using 3DES or AES. So if you’re seeing some performance issues in your JCE encryption/decryption code, start with the simple, and realize that getKey() can take some serious time.

Advertisement

0 Responses to “java.security.KeyStore.getKey() can be expensive”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s



Follow

Get every new post delivered to your Inbox.