pizzathehut
pizzathehut

Reputation: 113

What algorithm does java.security.KeyStore use to encrypt the privateKey in KeyStore.setKeyEntry() and KeyStore.store()?

setKeyEntry() allows a password to protect a single private key, and store() allows a password to encrypt the entire keyStore. I'm using pkcs12 keystore type with the BC as the provider, and I can't figure out what it's using for encryption.

Am I able to specify the kind of encryption used in these methods?

Upvotes: 6

Views: 15931

Answers (2)

President James K. Polk
President James K. Polk

Reputation: 41974

It depends on which KeyStore provider you are using.

The JCEKS provider uses PBEWithMD5AndTripleDES password-based encryption algorithm.

Upvotes: 2

erickson
erickson

Reputation: 269717

The KeyStore implementation depends on the type you request, and for some types, will depend on the provider as well.

If you are talking about the "JKS" type, you can find a description of the format and algorithms used here.

With a JKS key store, you cannot specify an encryption algorithm for private keys.

Upvotes: 2

Related Questions