Bug fix: properly calculating the signature on client and server. Added unit tests for this.