Make the valid_document function take a cert.

Accepting both certs and fingerprints removes a bunch of boilerplate.