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
9
src/com/coder/client/Session.java
Normal file → Executable file
9
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.Logger;
|
||||
|
||||
import zutil.Hasher;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.parser.json.JSONObjectInputStream;
|
||||
import zutil.parser.json.JSONObjectOutputStream;
|
||||
|
|
@ -17,6 +18,7 @@ import com.coder.server.message.CoderMessage;
|
|||
|
||||
public class Session extends Thread {
|
||||
public static final Logger logger = LogUtil.getLogger();
|
||||
private static final int AUTH_HASH_ITERATIONS = 500;
|
||||
|
||||
private HashSet<CoderMessageReceivedListener> messageReceivedlisteners = new HashSet<CoderMessageReceivedListener>();
|
||||
|
||||
|
|
@ -157,11 +159,10 @@ public class Session extends Thread {
|
|||
logger.fine("Received AuthenticationChallenge");
|
||||
|
||||
// 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 key = Hasher.PBKDF2(hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
||||
Encrypter crypto;
|
||||
/*Encrypter crypto;
|
||||
try {
|
||||
crypto = new Encrypter(key, Encrypter.Algorithm.AES);
|
||||
} catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeySpecException e) {
|
||||
|
|
@ -181,6 +182,8 @@ public class Session extends Thread {
|
|||
CoderMessage authRsp = new CoderMessage();
|
||||
authRsp.AuthenticationRsp = new AuthenticationRspMsg();
|
||||
authRsp.AuthenticationRsp.timestamp = System.currentTimeMillis();
|
||||
authRsp.AuthenticationRsp.hash = Hasher.PBKDF2(
|
||||
hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
||||
logger.fine("Sending AuthenticationRsp");
|
||||
send(authRsp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue