added checks for invalid encoding, invalid signature length.  added unit tests for these.