Both are prohibted.As in Islam it is strictly prohibted to touch a strange person for women and men.Even both hand shakers are muslim(even man or woman) or one is muslim and other one is non muslim
Surah An-Nur, Verses 30 and 31
'And Say to the believing women to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts) and not to show off their adornment except only that which is apparent (like both eyes for necessity to see the way, or outer palms of hands or one eye or dress like veil, gloves, head-cover, apron), and to draw their veils all over Juyubihinna (i.e. their bodies, faces, necks and bossoms) and not to reveal their adornment except to their husbands, or their fathers, or their husband's fathers, or their sons, or their husband's sons, or their brothers or their brother's sons, or their sister's sons, or their (Muslim women) (i.e. sisters in Islam), or the (female) slaves whom their right hands possess, or old male servants who lack vigour, or small children who have no sense of feminine sex. And let them not stamp their feet so as to reveal what they hide of their adornment. And all of you beg Allah to forgive you all, O believers, that you may be successful'
In THIS AYAT E PAK you can see that all womens are bound to hide them from others/strangers.So it is simply a logical thing that Even they are not allowed to someone see them then How it is possible that someone touch them?
So same as for Men , They can't touch any strange women and are not even allowed to see any strange women
Let me share you some detailed links about this
1, 2 , 3