computeSecret

fun computeSecret(remotePublicKey: ByteArray): ByteArray

Compute the shared secret from the remote peer's 96-byte public key. Returns remote^secret mod P as 96 big-endian bytes.

Faithful to libtorrent, degenerate remote keys are rejected: any value outside [2, P-2] collapses the shared secret into a tiny subgroup and would let a man-in-the-middle pin it, so this throws IllegalArgumentException (libtorrent's compute_secret returns false).