See the final version of Bruce Schneier's essay "Why Cryptography Is Harder Than It Looks ... " at: http://www.counterpane.com/whycrypto.html