For what its worth, my solution was to give the guard a set of sealed envelopes. Each envelope having a password written on the outside and a password written on a piece of paper inside. The spy would give the guard the word that is written on one of the envelopes, the guard would then open the envelope and ask the spy for the password contained inside.