Added assertion that certificate is valid.