handle some invalid payload conditions

* If the header is nonexistent
* If the header is valid, but the payload is nonexistent
* If the crypto segment is empty
fix rspec any_number_of_times deprecation warning