A. He said that if he had the key with him, he could give him/her the solution.
B. He said if he could have the key with him,he would give him/her the solution.
C. He told that if he could have the key with him, he would give him/her the solution.
D. He said that If he have had the key with him, he could have given him/her the solution.