Formal Models and Techniques for Analyzing Security Protocols: A Tutorial