I don't think an all 0 key poses an issue. Also increase logging when cannot connect to server.

This commit is contained in:
md_5 2012-11-19 20:39:24 +11:00
parent 02e00313bd
commit dbca9acac3
2 changed files with 3 additions and 5 deletions

View File

@ -14,7 +14,6 @@ import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
@ -43,6 +42,7 @@ public class EncryptionUtil
private static final Random random = new Random();
private static KeyPair keys;
private static SecretKey secret = new SecretKeySpec(new byte[16], "AES");
static
{
@ -114,9 +114,7 @@ public class EncryptionUtil
public static SecretKey getSecret()
{
byte[] rand = new byte[16];
random.nextBytes(rand);
return new SecretKeySpec(rand, "AES");
return secret;
}
public static PublicKey getPubkey(PacketFDEncryptionRequest request) throws InvalidKeySpecException, NoSuchAlgorithmException

View File

@ -87,7 +87,7 @@ public class ServerConnection extends GenericConnection
return connect(user, name, def, handshake, false);
} else
{
throw new RuntimeException("Could not connect to target server");
throw new RuntimeException("Could not connect to target server " + Util.exception(ex));
}
}
}