check certificate validity