[#725] Fixes optimization logic

* We want to only calculate the signature if `allowUnsignedData` is
  false
* We need to check if we have a .sig to compare to and, if we have
  actual data to calculate the signature on. If one of those is
  missing we throw an Exception.
Merge pull request #729 from akvo/issue/725

[#725] Fixes optimization logic