public CircuitNode createNewNode(Router r, byte[] keyMaterial, byte[] verifyDigest) { final CircuitNode node = CircuitNodeImpl.createNode(r, circuit.getFinalCircuitNode(), keyMaterial, verifyDigest); logger.fine("Adding new circuit node for " + r.getNickname()); circuit.appendNode(node); return node; }
private CircuitNode processCreatedFastCell(Router targetRouter, Cell cell, TorKeyAgreement kex) { final byte[] payload = new byte[TorMessageDigest.TOR_DIGEST_SIZE * 2]; final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE]; final byte[] verifyHash = new byte[TorMessageDigest.TOR_DIGEST_SIZE]; cell.getByteArray(payload); if (!kex.deriveKeysFromHandshakeResponse(payload, keyMaterial, verifyHash)) { // XXX return null; } final CircuitNode node = CircuitNodeImpl.createFirstHop(targetRouter, keyMaterial, verifyHash); circuit.appendNode(node); return node; }