I've been digging for the past few days into storage of sentitive data. If I store this data in a database, I believe the general accepted practice is to store sensitive data encrypted, for various reasons out of the scope of this question.
Encrypting data, however, means I have to manage the 'secrets' to this data. I've seen 2 main paths for this (in the java world), either KeyStores or HSMs. My first question is, are there any other valid alternatives (in the java world)?
There are multiple keystore formats that I can use in java, to name a few:
- jks
- jceks
- pkcs12
- bks
- uber
I've seen very little information on the security of a keystore. I've been thinking that, had I access to a keystore, and when I look at the java API since all keystores are protected by a password, I could simply brute force the keystore, however secure it is. The second question then becomes, is it generally accepted practice that since keystores are on different systems than the encrypted data and since they are password protected, then this is 'secure enough' for real life conditions? What about the storage of the password to the keystore? Are there any accepted practices there? For example, storing it in yet another system? Having it manually entered on application startup? Having it in an os-protected file where only the application has read access to it?
The next question is in regards to HSMs. Since I can brute force keystores, what's to prevent me to do the exact same thing to a HSM? Time? Having to be logged in to the remote system since there is no file for me to copy and work with remotely?
The final question is does anyone have any idea of what is considered secure enough in terms of secret management? I would assume it varies depending on the type of information encrypted with the secret. From what I've read elsewhere, keystores seem good enough for most typical scenarios and HSMs are necessary in very niche scenarios, for CAs, governments and the like.
Any insights appreciated.