title: JKS to BKS keystore
body: <p>I am trying to convert a JKS keystore to BKS keystore using the convert-keystore utility (<a href="https://code.google.com/p/zip-signer/downloads/detail?name=convert-keystore-1.2.zip&amp;can=2&amp;q=" rel="nofollow">https://code.google.com/p/zip-signer/downloads/detail?name=convert-keystore-1.2.zip&amp;can=2&amp;q=</a>).</p>
  
  <p>On executing the command </p>
  
  <pre><code>&gt; java -jar convert-keystore-1.2.jar server.keystore.jks server.keystore.bks
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>&gt;java.security.KeyStoreException: java.lang.NullPointerException
      at org.bouncycastle.jce.provider.JDKKeyStore.engineSetKeyEntry(Unknown Source)
      at java.security.KeyStore.setKeyEntry(KeyStore.java:880)
      at kellinwood.keystore.Convert.main(Convert.java:89)
  </code></pre>
  
  <p>The keystore was was created via Java keystore utility:</p>
  
  <blockquote>
    <p>keytool -genkey -alias myAlias -keyalg RSA -keysize 2048 -keystore server.keystore -validity 10000</p>
  </blockquote>
  
  <p>The CSR was generated from this keystore using:</p>
  
  <blockquote>
    <p>keytool -certreq -v -alias myAlias -file naavis_public.csr -keypass changeit -keystore server.keystore -storepass changeit</p>
  </blockquote>
  
  <p>Then I imported the certificates from Thawte:</p>
  
  <blockquote>
    <p>keytool -import -trustcacerts -alias SSL -keystore server.keystore.jks -file ssl.crt</p>
  </blockquote>
  
  <pre><code>&gt;keytool -import -trustcacerts -alias INTERMEDIATE -keystore server.keystore.jks -file intermediate.crt
  
  &gt;keytool -import -trustcacerts -alias ROOT -keystore server.keystore.jks -file root.crt
  </code></pre>
  
  <p>This went through without any errors and am able to use this keystore in my application.</p>
  
  <p>Kindly guide.
  I am using Java 1.6.45 and have the "java unlimited strength policy files" of the correct version. The keystore was also created on same java version.</p>
  
  <p>Have also tried this process on Java 1.7.55. It produces same error.</p>