private static Def convert(XmlConfig cfg, com.grey.naf.Config nafcfg, Def def, String peername, boolean client)
			throws com.grey.base.ConfigException, java.io.IOException
	{
		if (def == null) def = new Def();
		int pos = peername == null ? -1 : peername.indexOf(':');
		if (pos != -1) peername = peername.substring(0, pos);
		def.isClient = client;
		def.localCertAlias = cfg.getValue("@cert", false, null);
		def.peerCertName = cfg.getValue("@peercert", false, peername);
		def.clientAuth = cfg.getInt("@clientauth", false, def.clientAuth);
		def.trustFormat = cfg.getValue("@tstype", false, def.trustFormat);
		def.trustPasswd = cfg.getPassword("@tspass", def.trustPasswd);
		def.storeFormat = cfg.getValue("@kstype", false, def.storeFormat);
		def.storePasswd = cfg.getPassword("@kspass", def.storePasswd);
		def.certPasswd = cfg.getPassword("@certpass", def.certPasswd);
		def.protocol = cfg.getValue("@proto", false, def.protocol);
		def.sessionCache = cfg.getInt("@cache", false, def.sessionCache);
		def.sessionTimeout = cfg.getTime("@expiry", def.sessionTimeout);
		def.shakeFreq = cfg.getTime("@shake", def.shakeFreq);
		def.shakeTimeout = cfg.getTime("@timeout", def.shakeTimeout);
		def.latent = cfg.getBool("@latent", def.latent);
		def.mdty = (def.latent ? cfg.getBool("@mandatory", def.mdty) : false);

		if (nafcfg == null) {
			def.trustPath = makeURL(cfg.getValue("@tspath", false, def.trustPath == null ? null : def.trustPath.toString()));
			def.storePath = makeURL(cfg.getValue("@kspath", false, def.storePath == null ? null : def.storePath.toString()));
		} else {
			def.trustPath = nafcfg.getURL(cfg, "@tspath", null, false, def.trustPath == null ? null : def.trustPath.toString(), null);
			def.storePath = nafcfg.getURL(cfg, "@kspath", null, false, def.storePath == null ? null : def.storePath.toString(), null);
		}
		return def;
	}