Improved certificateCheck()

$KEY_SIZE and $CERTIFICATE_VALIDITY global variables added. Error
messages improved.