Hallo Leute !
Brauche seeeehr dringend eure Hilfe!
also es geht um folgendes:
Ich hab ein Jabber-Client der sich auf Java basiert, aber Problem ist das er das Passwort in eine buddyspace.conf Datei speichert, die man mühelos mit Editor aufmachen kann und Passwort nachschauen. Ich hab jetzt gefuden dass man das irgendwie mit MD5 das Password verschlüsseln kann. Ich hab Source-Code runtergeladen und jetzt weiss ich nicht wo ich da was ändern muss um das Passwort zu verschlüsseln
vielleicht die Datei hab ehrlichgesagt keine Ahnung:
verkürzt:
ein mal BSMainFrame(befindet sich in souce \buddyspace\client\edu\ou\kmi\buddyspace\gui):
vielleicht irgendwo hier drin ist es !
Brauche seeeehr dringend eure Hilfe!
also es geht um folgendes:
Ich hab ein Jabber-Client der sich auf Java basiert, aber Problem ist das er das Passwort in eine buddyspace.conf Datei speichert, die man mühelos mit Editor aufmachen kann und Passwort nachschauen. Ich hab jetzt gefuden dass man das irgendwie mit MD5 das Password verschlüsseln kann. Ich hab Source-Code runtergeladen und jetzt weiss ich nicht wo ich da was ändern muss um das Passwort zu verschlüsseln
vielleicht die Datei hab ehrlichgesagt keine Ahnung:
verkürzt:
ein mal BSMainFrame(befindet sich in souce \buddyspace\client\edu\ou\kmi\buddyspace\gui):
Code:
try {
File file = new File("./buddySpace.conf");
FileInputStream input = new FileInputStream(file);
props.load(input);
} catch (IOException e) {
System.out.println("Cannot read conf file");
return false;
} catch (NullPointerException e) {
System.out.println("Cannot read conf file");
return false;
}
return true;
}
/** Loads preferences */
protected void loadPreferences() {
if (!loadPreferences(properties))
return;
username = properties.getProperty(PREF_NAME_USERNAME, DEF_USERNAME);
resource = properties.getProperty(PREF_NAME_RESOURCE, DEF_RESOURCE);
server = properties.getProperty(PREF_NAME_SERVER, DEF_SERVER);
password = properties.getProperty(PREF_NAME_PASSWORD, DEF_PASSWORD);
port = Integer.parseInt(properties.getProperty(PREF_NAME_PORT, Integer.toString(DEF_PORT)));
useSSL = properties.getProperty(PREF_NAME_USE_SSL, useSSL? "true":"false").equals("true");
priority = Integer.parseInt(properties.getProperty(PREF_NAME_PRIORITY, Integer.toString(DEF_PRIORITY)));
autoLogin = properties.getProperty(PREF_NAME_AUTO_LOGIN, autoLogin? "true":"false").equals("true");
fileServer = properties.getProperty(PREF_NAME_FILE_SERVER, DEF_FILE_SERVER);
fileServerPath = properties.getProperty(PREF_NAME_FILE_SERVER_PATH, DEF_FILE_SERVER_PATH);
fileServerPort = properties.getProperty(PREF_NAME_FILE_SERVER_PORT, DEF_FILE_SERVER_PORT);
proxy = properties.getProperty(PREF_NAME_PROXY, DEF_PROXY);
proxyPort = properties.getProperty(PREF_NAME_PROXY_PORT, DEF_PROXY_PORT);
compactView = properties.getProperty(PREF_NAME_COMPACT_VIEW, compactView? "true":"false").equals("true");
onlyOnline = properties.getProperty(PREF_NAME_ONLY_ONLINE, onlyOnline? "true":"false").equals("true");
dockWindows = properties.getProperty(PREF_NAME_DOCK_WINDOWS, dockWindows? "true":"false").equals("true");
showMsgs = properties.getProperty(PREF_NAME_SHOW_MSGS, showMsgs? "true":"false").equals("true");
forceMsgsIntoChat = properties.getProperty(PREF_NAME_FORCE_MSGS_INTO_CHAT, forceMsgsIntoChat? "true":"false").equals("true");
autoAway = properties.getProperty(PREF_NAME_AUTO_AWAY, autoAway? "true":"false").equals("true");
showStatus = properties.getProperty(PREF_NAME_SHOW_STATUS, showStatus? "true":"false").equals("true");
showDebug = properties.getProperty(PREF_NAME_SHOW_DEBUG, showDebug? "true":"false").equals("true");
scrollTabs = properties.getProperty(PREF_NAME_SCROLL_TABS, scrollTabs? "true":"false").equals("true");
//logoImgPath = properties.getProperty(PREF_NAME_LOGO_IMG_PATH, DEF_LOGO_IMG_PATH);
autoSelectChat = properties.getProperty(PREF_NAME_AUTO_SELECT, autoSelectChat? "true":"false").equals("true");
newMsgSoundFileName = properties.getProperty(PREF_NAME_NEW_MSG_SOUND_FILE_NAME, DEF_NEW_MSG_SOUND_FILE_NAME);
currentLookAndFeel = properties.getProperty(PREF_NAME_LAF, "");
//ixPropsPath = properties.getProperty(PREF_NAME_IX_PROPS_PATH, DEF_IX_PROPS_PATH);
}
/** Saves preferences */
protected void savePreferences() {
// *** pripadne ulozit/vytvorit jen profil se zadanym cislem nebo jmenem ***
/*Preferences prefs = Preferences.userNodeForPackage(BSCore.class);
prefs.putByteArray(PREF_NAME_USERNAME, username.getBytes());
prefs.putByteArray(PREF_NAME_RESOURCE, resource.getBytes());
prefs.putByteArray(PREF_NAME_SERVER, server.getBytes());
prefs.putByteArray(PREF_NAME_PASSWORD, password.getBytes());
prefs.putInt(PREF_NAME_PORT, port);
prefs.putByteArray(PREF_NAME_PROXY, proxy.getBytes());
prefs.putInt(PREF_NAME_PROXY_PORT, Integer.parseInt(proxyPort));
prefs.putByteArray(PREF_NAME_FILE_SERVER, fileServer.getBytes());
prefs.putByteArray(PREF_NAME_FILE_SERVER_PATH, fileServerPath.getBytes());
prefs.putByteArray(PREF_NAME_FILE_SERVER_PORT, fileServerPort.getBytes());
prefs.putByteArray(PREF_NAME_IX_PROPS_PATH, ixPropsPath.getBytes());
prefs.putByteArray(PREF_NAME_LOGO_IMG_PATH, logoImgPath.getBytes());
//prefs.putBoolean( NAME_DOCK_FOCUS_VIEW, bDockFocusView ); */
properties.setProperty(PREF_NAME_USERNAME, username);
properties.setProperty(PREF_NAME_RESOURCE, resource);
properties.setProperty(PREF_NAME_SERVER, server);
properties.setProperty(PREF_NAME_PASSWORD, password);
properties.setProperty(PREF_NAME_PORT, Integer.toString(port));
properties.setProperty(PREF_NAME_USE_SSL, useSSL? "true":"false");
properties.setProperty(PREF_NAME_PRIORITY, Integer.toString(priority));
properties.setProperty(PREF_NAME_AUTO_LOGIN, autoLogin? "true":"false");
properties.setProperty(PREF_NAME_FILE_SERVER, fileServer);
properties.setProperty(PREF_NAME_FILE_SERVER_PATH, fileServerPath);
properties.setProperty(PREF_NAME_FILE_SERVER_PORT, fileServerPort);
properties.setProperty(PREF_NAME_PROXY, proxy);
properties.setProperty(PREF_NAME_PROXY_PORT, proxyPort);
properties.setProperty(PREF_NAME_COMPACT_VIEW, compactView? "true":"false");
properties.setProperty(PREF_NAME_ONLY_ONLINE, onlyOnline? "true":"false");
properties.setProperty(PREF_NAME_DOCK_WINDOWS, dockWindows? "true":"false");
properties.setProperty(PREF_NAME_SHOW_MSGS, showMsgs? "true":"false");
properties.setProperty(PREF_NAME_FORCE_MSGS_INTO_CHAT, forceMsgsIntoChat? "true":"false");
properties.setProperty(PREF_NAME_AUTO_AWAY, autoAway? "true":"false");
properties.setProperty(PREF_NAME_SHOW_STATUS, showStatus? "true":"false");
properties.setProperty(PREF_NAME_SHOW_DEBUG, showDebug? "true":"false");
properties.setProperty(PREF_NAME_SCROLL_TABS, scrollTabs? "true":"false");
//properties.setProperty(PREF_NAME_LOGO_IMG_PATH, logoImgPath);
properties.setProperty(PREF_NAME_AUTO_SELECT, autoSelectChat? "true":"false");
properties.setProperty(PREF_NAME_NEW_MSG_SOUND_FILE_NAME, newMsgSoundFileName);
properties.setProperty(PREF_NAME_LAF, currentLookAndFeel);
//properties.setProperty(PREF_NAME_IX_PROPS_PATH, ixPropsPath);
saveProperties(properties);
}
public boolean saveProperties(Properties props) {
if (props == null) return true;
Enumeration propKeyes = props.keys();
while (propKeyes.hasMoreElements()) {
String k = (String) propKeyes.nextElement();
properties.setProperty(k, (String) props.get(k));
}
try {
File file = new File("./buddySpace.conf");
FileOutputStream output = new FileOutputStream(file);
props.store(output, "BuddySpace configuration file");
} catch (IOException e) {
System.out.println("Cannot write conf file");
return false;
} catch (NullPointerException e) {
System.out.println("Cannot write conf file");
return false;
}
return true;
}
public boolean saveStatusesBarJIDs(Enumeration jids) {
Properties props = new Properties();
if (!loadPreferences(props))
return false;
int jidNum = 0;
while (jids.hasMoreElements()) {
jidNum++;
JID jid = (JID) jids.nextElement();
String name = new String (PREF_NAME_STATUSES_BAR_JID + Integer.toString(jidNum));
props.setProperty(name, jid.toString());
//properties.setProperty(name, jid.toString());
}
props.setProperty(PREF_NAME_STATUSES_BAR_JID_NUM, Integer.toString(jidNum));
//properties.setProperty(PREF_NAME_STATUSES_BAR_JID_NUM, Integer.toString(jidNum));
return saveProperties(props);
}
public boolean addAndSavePreferences(String[] names, String[] values) {
Properties props = new Properties();
if (!loadPreferences(props))
return false;
int prefNum = (names.length < values.length)? names.length : values.length;
for (int i=0; i < prefNum; i++) {
props.setProperty(names[i], values[i]);
}
vielleicht irgendwo hier drin ist es !