Bringing up a person as not a reason to deem him Mahram
Q: My mother passed away (may Allah be merciful with her) in my early childhood. My maternal uncle took permission from my father and took me to reside in his home. I was about one year and a half or two years of age at the time. My concerned uncle's wife who was sterile and had no children was responsible for bringing me up. She would stay up (late) at night looking after me and removing impurities from me; may Allah honor you. I thus regarded her as my mother. I stayed with my maternal uncle and his wife for ten years or more. However, it happened that my maternal uncle divorced his wife upon her request and she then got married to another person. I did not stop visiting her until she went to
for a surgical operation. Treating her as a mother and bearing in mind that her husband had recently died, my wife and I visited her (Part No. 17; Page No. 396) to offer her our condolences. When we reached her place she was putting on her Hijab (veil) but I shook hands with her and kissed her forehead as usual. Nevertheless, she turned down and told me that she feared this might be Haram (prohibited). I told her not to fear because I am just like her son and that taking off Hijab in my presence is not a sin. Afterwards I doubted the matter and wanted your Fatwa in this regard.
If the matter is exactly as what is mentioned in the question, the concerned lady is considered a non-Mahram (not a spouse or an unmarriageable relative) to you.
The fact that she brought you up does not render taking off the Hijab in your presence or Khulwah (being alone with a member of the opposite sex) with you permissible. Likewise, it is impermissible for you to shake hands with her or to kiss her head because you are a non-Mahram to her. You have mentioned nothing that might make you a Mahram to her. However, you are to be thanked for your Shar`y (Islamic legal) benevolence towards her because of the efforts she has exerted in bringing you up and being good to you when you were a child. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.