# Cannot launch elasticsearch, Exception in thread "main" java.security.spec.InvalidKeySpecException: Could not generate secret key

**URL:** https://discuss.elastic.co/t/cannot-launch-elasticsearch-exception-in-thread-main-java-security-spec-invalidkeyspecexception-could-not-generate-secret-key/144952
**Category:** Elasticsearch
**Created:** [August 17, 2018, 7:10pm UTC](https://discuss.elastic.co/t/cannot-launch-elasticsearch-exception-in-thread-main-java-security-spec-invalidkeyspecexception-could-not-generate-secret-key/144952 "2018-08-17T19:10:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Edw](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Edw](https://discuss.elastic.co/u/Edw)
#### Post date: [August 17, 2018, 7:10pm UTC](https://discuss.elastic.co/t/cannot-launch-elasticsearch-exception-in-thread-main-java-security-spec-invalidkeyspecexception-could-not-generate-secret-key/144952/1 "2018-08-17T19:10:14Z")

</div>

Prior to executing ./elasticsearch, I attempt to create a keystore, but get the below error

/elasticsearch-keystore create  
Exception in thread "main" java.security.spec.InvalidKeySpecException: Could not generate secret key  
at javax.crypto.SecretKeyFactory.generateSecret(Unknown Source)  
at org.elasticsearch.common.settings.KeyStoreWrapper.createCipher(KeyStoreWrapper.java:289)  
at org.elasticsearch.common.settings.KeyStoreWrapper.encrypt(KeyStoreWrapper.java:361)  
at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:473)  
at org.elasticsearch.common.settings.CreateKeyStoreCommand.execute(CreateKeyStoreCommand.java:58)  
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)  
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:79)  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)  
at org.elasticsearch.cli.Command.main(Command.java:90)  
at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:41)  
Caused by: java.lang.RuntimeException: Error deriving PBKDF2 keys  
at com.ibm.crypto.provider.PBKDF2KeyImpl.a(Unknown Source)  
at com.ibm.crypto.provider.PBKDF2KeyImpl.(Unknown Source)  
at com.ibm.crypto.provider.bm.engineGenerateSecret(Unknown Source)  
... 11 more

What is the issue?

I am exporting my Java variable to the OpenJDK 10 and operating on the OpenJDK

openjdk version "10.0.2" 2018-07-17  
OpenJDK Runtime Environment 18.3 (build 10.0.2+13)  
OpenJDK 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

/elasticsearch -version  
Version: 6.3.2, Build: default/zip/053779d/2018-07-20T05:20:23.451332Z, JVM: 1.8.0\_161

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [August 17, 2018, 9:00pm UTC](https://discuss.elastic.co/t/cannot-launch-elasticsearch-exception-in-thread-main-java-security-spec-invalidkeyspecexception-could-not-generate-secret-key/144952/2 "2018-08-17T21:00:34Z")

</div>

Are you sure you are not using an IBM jdk? Both your stack trace, and some googling indicate this is a problem with that. We currently use an empty passphrase in the keystore. Note that starting in 6.4.0, the keystore implementation has been reworked so it no longer uses PBKDF2, so this would go away. But Elastic still does not officially support running on IBM's java.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 14, 2018, 9:00pm UTC](https://discuss.elastic.co/t/cannot-launch-elasticsearch-exception-in-thread-main-java-security-spec-invalidkeyspecexception-could-not-generate-secret-key/144952/3 "2018-09-14T21:00:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
