Remove trailing whitespace from messages before serialising.

YAML strips trailing whitespace from messages, which breaks signature
verification.