Updated authentication and some updates to SSDPClient class
This commit is contained in:
parent
d9c86b44e0
commit
5d9215c493
2 changed files with 8 additions and 5 deletions
0
src/com/coder/client/CoderClient.java
Normal file → Executable file
0
src/com/coder/client/CoderClient.java
Normal file → Executable file
13
src/com/coder/client/Session.java
Normal file → Executable file
13
src/com/coder/client/Session.java
Normal file → Executable file
|
|
@ -7,6 +7,7 @@ import java.util.HashSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import zutil.Hasher;
|
||||||
import zutil.log.LogUtil;
|
import zutil.log.LogUtil;
|
||||||
import zutil.parser.json.JSONObjectInputStream;
|
import zutil.parser.json.JSONObjectInputStream;
|
||||||
import zutil.parser.json.JSONObjectOutputStream;
|
import zutil.parser.json.JSONObjectOutputStream;
|
||||||
|
|
@ -17,8 +18,9 @@ import com.coder.server.message.CoderMessage;
|
||||||
|
|
||||||
public class Session extends Thread {
|
public class Session extends Thread {
|
||||||
public static final Logger logger = LogUtil.getLogger();
|
public static final Logger logger = LogUtil.getLogger();
|
||||||
|
private static final int AUTH_HASH_ITERATIONS = 500;
|
||||||
private HashSet<CoderMessageReceivedListener> messageReceivedlisteners = new HashSet<CoderMessageReceivedListener>();
|
|
||||||
|
private HashSet<CoderMessageReceivedListener> messageReceivedlisteners = new HashSet<CoderMessageReceivedListener>();
|
||||||
|
|
||||||
private boolean authenticated = false;
|
private boolean authenticated = false;
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
@ -157,11 +159,10 @@ public class Session extends Thread {
|
||||||
logger.fine("Received AuthenticationChallenge");
|
logger.fine("Received AuthenticationChallenge");
|
||||||
|
|
||||||
// Setting up encryption
|
// Setting up encryption
|
||||||
/*
|
//logger.fine("Setting up encryption");
|
||||||
logger.fine("Setting up encryption");
|
|
||||||
String hashedPassword = Hasher.PBKDF2(new String(clearTextPassword), username, AUTH_HASH_ITERATIONS);
|
String hashedPassword = Hasher.PBKDF2(new String(clearTextPassword), username, AUTH_HASH_ITERATIONS);
|
||||||
String key = Hasher.PBKDF2(hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
String key = Hasher.PBKDF2(hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
||||||
Encrypter crypto;
|
/*Encrypter crypto;
|
||||||
try {
|
try {
|
||||||
crypto = new Encrypter(key, Encrypter.Algorithm.AES);
|
crypto = new Encrypter(key, Encrypter.Algorithm.AES);
|
||||||
} catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeySpecException e) {
|
} catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeySpecException e) {
|
||||||
|
|
@ -181,6 +182,8 @@ public class Session extends Thread {
|
||||||
CoderMessage authRsp = new CoderMessage();
|
CoderMessage authRsp = new CoderMessage();
|
||||||
authRsp.AuthenticationRsp = new AuthenticationRspMsg();
|
authRsp.AuthenticationRsp = new AuthenticationRspMsg();
|
||||||
authRsp.AuthenticationRsp.timestamp = System.currentTimeMillis();
|
authRsp.AuthenticationRsp.timestamp = System.currentTimeMillis();
|
||||||
|
authRsp.AuthenticationRsp.hash = Hasher.PBKDF2(
|
||||||
|
hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
||||||
logger.fine("Sending AuthenticationRsp");
|
logger.fine("Sending AuthenticationRsp");
|
||||||
send(authRsp);
|
send(authRsp);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue