code: public static KeyStoreManager getKeyStoreManager(String hostname) throws Exception {
  		File root = getKeyStoreRoot(hostname);
  
      	// create entry
      	KeyStoreManager keyStoreManager = new KeyStoreManager(root);
      	
      	// under the hood this will generate the cert if it doesn't exist
      	keyStoreManager.getCertificateByHostname(hostname);
      	
      	// use this since getCertificateByHostname always returns null, but hostname == alias for our purpose
      	X509Certificate cert = keyStoreManager.getCertificateByAlias(hostname);
      	try {
      		cert.checkValidity();
      	} catch (CertificateExpiredException cee) {
      		// if the cert is expired we should destroy it and recursively call this function
      		keyStoreManager = null;
      		FileUtils.deleteDirectory(root);
      		
      		return getKeyStoreManager(hostname);
      	}
      	
      	return keyStoreManager;
  	}
docs: Gets a keystore manager for a given hostname
  Creates one/key if it does not already exist
  @param hostname
  @return
  @throws Exception