Function to generate challenge/response/message