code: public final void setKeyEntry(String alias, byte[] key,
                                    Certificate[] chain)
          throws KeyStoreException
      {
          if (!initialized) {
              throw new KeyStoreException("Uninitialized keystore");
          }
          keyStoreSpi.engineSetKeyEntry(alias, key, chain);
      }
docs: Assigns the given key (that has already been protected) to the given
  alias.
  
  <p>If the protected key is of type
  <code>java.security.PrivateKey</code>, it must be accompanied by a
  certificate chain certifying the corresponding public key. If the
  underlying keystore implementation is of type <code>jks</code>,
  <code>key</code> must be encoded as an
  <code>EncryptedPrivateKeyInfo</code> as defined in the PKCS #8 standard.
  
  <p>If the given alias already exists, the keystore information
  associated with it is overridden by the given key (and possibly
  certificate chain).
  
  @param alias the alias name
  @param key the key (in protected format) to be associated with the alias
  @param chain the certificate chain for the corresponding public
  key (only useful if the protected key is of type
  <code>java.security.PrivateKey</code>).
  
  @exception KeyStoreException if the keystore has not been initialized
  (loaded), or if this operation fails for some other reason.