Break the signPublicKey() implementation down to methods to
improve clarity.