FileDocCategorySizeDatePackage
StrongClient.javaAPI DocExample1532Tue Feb 24 10:26:32 GMT 1998None

StrongClient

public class StrongClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    if (args.length != 5) {
      System.out.println(
          "Usage: StrongClient host keystore storepass alias keypass");
      return;
    }
    
    String host = args[0];
    String keystorefile = args[1];
    String storepass = args[2];
    String alias = args[3];
    String keypass = args[4];
    
    int port = 7999;
    Socket s = new Socket(host, port);

    StrongClient client = new StrongClient();
    KeyStore keystore = KeyStore.getInstance();
    keystore.load(new FileInputStream(keystorefile), storepass);
    PrivateKey key = keystore.getPrivateKey(alias, keypass);
    client.sendAuthentication(alias, key, s.getOutputStream());

    s.close();
  
public voidsendAuthentication(java.lang.String user, java.security.PrivateKey key, java.io.OutputStream outStream)

    DataOutputStream out = new DataOutputStream(outStream);
    long t = (new Date()).getTime();
    double q = Math.random();

    Signature s = Signature.getInstance("DSA");
    s.initSign(key);
    s.update(Protection.makeBytes(t, q));
    byte[] signature = s.sign();

    out.writeUTF(user);
    out.writeLong(t);
    out.writeDouble(q);
    out.writeInt(signature.length);
    out.write(signature);
    out.flush();