Prevent empty secrets

Add sanity checks to make sure secrets exist before checking the
signatures.

Also some whitespace and formatting cleanup.

Change-Id: Ib821c9baefa5a51e6809285f47a88cbf8b843e23
Merge "Prevent empty secrets"