title: java - how to store a key in keystore
body: <p>I've need to store 2 keys into KeyStore
  Here's the relevant code:</p>
  
  <pre><code>KeyStore ks = KeyStore.getInstance("JKS");
  String password = "password";
  char[] ksPass = password.toCharArray();
  ks.load(null, ksPass);
  ks.setKeyEntry("keyForSeckeyDecrypt", privateKey, null, null);
  ks.setKeyEntry("keyForDigitalSignature", priv, null, null);
  FileOutputStream writeStream = new FileOutputStream("key.store");
  ks.store(writeStream, ksPass);
  writeStream.close();
  </code></pre>
  
  <p>Though I get an execption "Private key must be accompanied by certificate chain"</p>
  
  <p>What is that, exactly? and how would I generate it?</p>