ProtectedClientpublic class ProtectedClient extends Object
Methods Summary |
---|
public static void | main(java.lang.String[] args)
String host = args[0];
int port = 7999;
String user = "Jonathan";
String password = "buendia";
Socket s = new Socket(host, port);
ProtectedClient client = new ProtectedClient();
client.sendAuthentication(user, password, s.getOutputStream());
s.close();
| public void | sendAuthentication(java.lang.String user, java.lang.String password, java.io.OutputStream outStream)
DataOutputStream out = new DataOutputStream(outStream);
long t1 = (new Date()).getTime();
double q1 = Math.random();
byte[] protected1 = Protection.makeDigest(user, password, t1, q1);
out.writeUTF(user);
out.writeLong(t1);
out.writeDouble(q1);
out.writeInt(protected1.length);
out.write(protected1);
out.flush();
|
|