I have been reading about JKS Java keystore, but didn´t find details about the format.
- The store password is just to verify the integrity of the file?
- How does the private keys are protected?
details about [JKS] format.
This is implemented by
(source in mercurial)
but is pretty simple and based on Java's
4-byte magic number, 4-byte version number, 4-byte count of entries; a variable number of entries each containing 4-byte type, length+(modified)UTF name, 8-byte timestamp, length+encoding+certcount for a privatekey, and type (in practice always
X.509)+length+encoding for the/each certificate; and at the end hash of password plus preceding data for integrity check.
The store password is just to verify the integrity of the file?
Yes. The JCA API, and the JKS format, allows each privatekey to be encrypted with a separate password, which can be different from the store password.
keytool for example allows you to specify a key password, but defaults it to be the same as the store password. However, some programs cannot cope with differing key and store passwords; in particular, those using the default trustmanager and/or keymanager for SSL/TLS (and thus HTTPS) so in those cases the same password must be used for both store and key(s).
How does the private keys are protected?
Each privatekey is PBE+hash using a 'proprietary' scheme in
(source in mercurial) and formatted in the file as a PKCS#8