Reading Oracle documentation, I see that by default JKS files are encrypted using PBEWithMD5AndTripleDES. While DES alone makes me feel uneasy, MD5 lights a big red light. I’d like to use PBEWithSHA256And256BitAES-CBC-BC or PBEWithSHA256And128bitAES-CBC-BC to encrypt private keys.
Do I have to write new Cryptography Service Provider implementing whole KeyStore interface or is it possible to parametrise the creation of KeyStore (either using plain java or BouncyCastle)?
EDIT:
A little bit of background.
I know that 3DES isn’t broken, just as is MD5 used as KDF (or in PBE). The problem is, that this is the situation for now. For all we know, MD5 may be broken to the level MD4 is broken tomorrow. My application life is at least 10 years, and it’s very likely it’s much more. Somehow I don’t see people after those 10 years delving deep into working crypto code just because it may not be secure. One just needs to look at last few of the big “mishaps” with password leaks to see how likely is that, and that were obvious things to anyone that saw the raw database.
That being said: NSA crypto suite B allows only AES for symmetric encryption, of any kind.
NIST list only SHA-1 and SHA-2 algorithms for HMAC and KDF use, while SHA-1 use is not recommended. Suite B allows only SHA-2 hash functions. Those algorithms are publicly available, so why shouldn’t I use them?
In the end I went with PKCS#8 files encrypted using
PBEWithSHA256And256BitAES-CBC-BCEncryption:
Decryption: