Maybe you didn’t notice the fact your cable is damaged or loose. Try changing the cable which connects your iPhone to your desktop computer or laptop. With a bit of luck, this will solve the problem.
Unplug the cable from the USB port, and plug them into another port available.
Press and hold the sleep/wake button and drag the slider to restart your device. Once you are finished with this task, try to restore or update your device again.
If your iTunes is not up to date, that might be the reason why you got the error. Open the program, and Check for Updates. Download and install it.
First, update your security software if possible. Another solution is to turn it off while you are restoring or updating your computer. If nothing works, uninstall it from your computer.