This may not be exactly what you are looking for, but you might be interested in how signed messages work in OStatus (salmons) and ActivityPub (LD Signatures). The technical details are borderline terrible (especially for ActivityPub), but the upshot is that when a server receives a message from another server that it federates with, it checks the message signature to be sure it's from who it claims to be.