Check if private key matches cert only if both key and cert are set