code: @Override
  	public void engineSetCertificateEntry(String alias, Certificate certificate)
  			throws KeyStoreException {
  
  		if (!(certificate instanceof X509Certificate)) {
  			throw new KeyStoreException(
  					"Certificate must be instance of X509Certificate");
  		}
  		File file;
  		ResourceTrustAnchor trustAnchor = getCertificateEntry(alias);
  		if (trustAnchor != null) {
  			file = trustAnchor.getFile();
  		} else {
  			file = new File(defaultDirectory, alias);
  		}
  		X509Certificate x509Cert = (X509Certificate) certificate;
  		try {
  			if(!inMemoryOnly){
  				writeCertificate(x509Cert, file);
  			}
  			ResourceTrustAnchor anchor = new ResourceTrustAnchor(inMemoryOnly,
  					new GlobusResource(file.getAbsolutePath()), new TrustAnchor(x509Cert,
  							null));
  			this.aliasObjectMap.put(alias, anchor);
  			this.certFilenameMap.put(x509Cert, alias);
  		} catch (ResourceStoreException e) {
  			throw new KeyStoreException(e);
  		} catch (IOException e) {
  			throw new KeyStoreException(e);
  		} catch (CertificateEncodingException e) {
  			throw new KeyStoreException(e);
  		}
  	}
docs: Add a certificate to the keystore.
  
  @param alias
  The certificate alias.
  @param certificate
  The certificate to store.
  @throws KeyStoreException