code: @Override
  	public void engineSetKeyEntry(String s, Key key, char[] chars,
  			Certificate[] certificates) throws KeyStoreException {
  
  		if (!(key instanceof PrivateKey)) {
  			throw new KeyStoreException("PrivateKey expected");
  		}
  
  		if (!(certificates instanceof X509Certificate[])) {
  			throw new KeyStoreException(
  					"Certificate chain of X509Certificate expected");
  		}
  		CredentialWrapper wrapper;
  		X509Credential credential = new X509Credential((PrivateKey) key,
  				(X509Certificate[]) certificates);
  		if (credential.isEncryptedKey()) {
  			wrapper = createCertKeyCredential(s, credential);
  		} else {
  			wrapper = createProxyCredential(s, credential);
  		}
  		storeWrapper(wrapper);
  		this.aliasObjectMap.put(wrapper.getAlias(), wrapper);
  	}
docs: Add a new private key to the keystore.
  
  @param s
  The alias for the object.
  @param key
  The private key.
  @param chars
  The password.
  @param certificates
  The key's certificate chain.
  @throws KeyStoreException