title: Storing key using Keystore
body: <p>I am using keystore to protect private key in a file(with a password for that file).I did not understand this code</p>
  
  <pre><code>// save my secret key
  javax.crypto.SecretKey mySecretKey;
  KeyStore.SecretKeyEntry skEntry =
      new KeyStore.SecretKeyEntry(mySecretKey);
  ks.setEntry("secretKeyAlias", skEntry, 
      new KeyStore.PasswordProtection(password));
  
  // store away the keystore
  java.io.FileOutputStream fos = null;
  try {
      fos = new java.io.FileOutputStream("newKeyStoreName");
      ks.store(fos, password);
  } finally {
      if (fos != null) {
          fos.close();
      }
  }
  </code></pre>
  
  <p>What is setEntry doing??
  Are we saving private key through fileoutputstream ??If it is true where is the password for the file???
  What is the extention of the file??Is it .jks??</p>