Examples of KexDHReplyMessage


Examples of org.xulfactory.gliese.message.KexDHReplyMessage

    } while (x.compareTo(q) >= 0);
    e = G.modPow(x, p);
    KexDHInitMessage init = new KexDHInitMessage();
    init.setE(e);
    transport.writeMessage(init);
    KexDHReplyMessage reply = (KexDHReplyMessage)transport
      .readMessage(NAMESPACE);

    BigInteger f = reply.getF();
    k = f.modPow(x, p);

    byte[] ks = reply.getKS();
    if (!hv.isTrusted(transport, reply.getKeyFormat(), ks)) {
      throw new SSHException("Server host key not trusted");
    }
    SSHPublicKey pubkey = pkf.decode(ks);
    Signature verifier = pubkey.getVerifier();

    dg.reset();
    dg.update(Utils.encodeBytes(transport.getVC()));
    dg.update(Utils.encodeBytes(transport.getVS()));
    dg.update(Utils.encodeBytes(transport.getIC()));
    dg.update(Utils.encodeBytes(transport.getIS()));
    dg.update(Utils.encodeBytes(reply.getKS()));
    dg.update(Utils.encodeBigInt(e));
    dg.update(Utils.encodeBigInt(f));
    dg.update(Utils.encodeBigInt(k));
    h = dg.digest();
    try {
      verifier.update(h);
      if(!verifier.verify(reply.getSigBlob())) {
        GlieseLogger.LOGGER.warn("Server authentication failed.");
        throw new SSHException("Server authentication failed.");
      }
    } catch (SignatureException se) {
      // FIXME
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.