Until a few years ago there was no good way to do the latter, in the sense that any convenient encryption scheme could be broken by a sufficiently determined and resourceful opponent. That has changed with the growing popularity of the free software package PGP, authored by Philip Zimmermann, a programmer and small-computer consultant here in Boulder. In fact, this is my own public key. Users of PGP generate a pair of keys, one public and one secret. The two keys represent two very large numbers that are related mathematically but impossible to derive from one another using current technology.
Individuals can share their public keys by post or e-mail, phone or fax, billboard or skywriting.
Any eavesdropping third party, who has only the two public keys, cannot unscramble the encrypted message. The scheme that can accomplish this magic is RSA, invented by Ron Rivest, Adi Shamir, and Leonard Adleman, and published in 1977. The latter, which is like a super-password, protects your secret key. Personal privacy sounds great, but remember that the same software can be used by, say, terrorists and pornographers to keep their own files and communications secret. Some branches of government such as the National Security Agency, employer of the best cryptographic staff and hardware in the world, are less than happy about such top-quality encryption being in the hands of everyone.