Add more robust empty credential detection

Add more robust detection of empty credentials, add comments.

Signed-off-by: Jeff Godin <jgodin@tadl.org>