return deriveKeysFromDHPublicAndHash(peerPublic, keyHash, keyMaterialOut, verifyHashOut);
}
public boolean deriveKeysFromDHPublicAndHash(BigInteger peerPublic, byte[] keyHash, byte[] keyMaterialOut, byte[] verifyHashOut) {
if(!isValidPublicValue(peerPublic)) {
throw new TorException("Illegal DH public value");
}
final byte[] sharedSecret = getSharedSecret(peerPublic);
final TorKeyDerivation kdf = new TorKeyDerivation(sharedSecret);
kdf.deriveKeys(keyMaterialOut, verifyHashOut);
return Arrays.equals(verifyHashOut, keyHash);