“Today, most email is sent like a postcard. Anybody on the path can read it, ranging from oppressive govern- ments to teenagers able to break into networks with far too many security holes. We all should want to put our mail back into secure envelopes again. PGP and GPG are two of the leading tools to make that happen.” — Brad Templeton, Chairman of the Board, Electronic Frontier Foundation Governments around the world, major industrial manu- facturers, medical facilities, and the best computer security practitioners trust their secure communications to PGP (Pretty Good Privacy). But, while PGP works amazingly when all is in order, it isn’t always easy to configure, and problems can be very tricky to troubleshoot. And email security is hardly the sort of thing you want to leave to trial and error. PGP & GPG: Email for the Practical Paranoid is for moderately skilled geeks who may be unfamiliar with public-key cryptography but would like to protect their communications on the cheap. Author Michael Lucas offers an easy-to-read, informal tutorial for communicat- ing securely with PGP, so you can dive in right away. Inside PGP & GPG, you’ll learn: • How to integrate OpenPGP with the most common email clients (like Outlook and Thunderbird) • How to use the tricky command-line versions of these programs • How to join and use the Web of Trust • What to do at a keysigning party (besides drink) PGP & GPG allows anyone to protect his or her personal data with free tools. If you’re not using PGP yet, this book will get you started without making you feel like a deer in headlights. If you’re already using PGP, it will show you how to use these tools more easily and effectively to protect your communication. About the author Michael W. Lucas is a network and security engineer with extensive experience working with high-availability systems, as well as intra-office and nationwide networks. He is the author of the critically acclaimed Absolute BSD, Absolute OpenBSD, and Cisco Routers for the Desperate (all No Starch Press). HOW TO CO M M U N I CATE SECURELY IN A N I N S ECURE WORLD HOW TO CO M M U N I CATE SECURELY IN a n i n s ecure wo r ld www.nostarch.com “I lay flat.” This book uses RepKover —a durable binding that won’t snap shut. TH E F I N EST I N G E E K E NTE R TA I N M E N T ™ SHELVE IN: COMPUTERS/SECURITY $24.95 ($32.95 CDN) 5 2 4 9 5 9 7 81 5 9 3 2 7 0 7 1 1 ISBN: 1-59327-071-2 6 8 9 1 4 5 7 07 1 2 0 L UC A S PGP & GPG PGP & GPG PGP & GPG PGP & GPG E M A I L F O R T H E P R A C T I C A L P A R A N O I D M i c h a e l W . L u c a s “…T HE WO RLD'S FIRST USE R-FRIEN DLY BO OK ON EM AI L P RI VACY… UNLESS YO U'RE A C RYPTO GRA P H ER, O R N EVER USE E MAI L, YOU SH OULD RE A D THIS BO OK .” — LEN SASSA MAN , CO DECO N FOUN DER PGP & GPG Email for the Practical Paranoid by Michael W. Lucas San Francisco PGP & GPG. Copyright © 2006 by Michael W. Lucas. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any informa- tion storage or retrieval system, without the prior written permission of the copyright owner and the publisher. Printed on recycled paper in the United States of America 1 2 3 4 5 6 7 8 9 10 – 09 08 07 06 No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respec- tive owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Publisher: William Pollock Managing Editor: Elizabeth Campbell Associate Production Editor: Christina Samuell Cover and Interior Design: Octopod Studios Developmental Editor: William Pollock Technical Reviewers: Henry Hertz Hobbit, J. Wren Hunt, Thomas Jones, Srijith Krishnan Nair, Len Sassaman, David Shaw, and Thomas Sjorgeren Copyeditor: Nancy Sixsmith Compositor: Riley Hoffman Proofreader: Nancy Riddiough Indexer: Nancy Guenther For information on book distributors or translations, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 555 De Haro Street, Suite 250, San Francisco, CA 94107 phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; www.nostarch.com The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it. Library of Congress Cataloging-in-Publication Data Lucas, Michael, 1967- PGP & GPG : email for the practical paranoid / Michael W. Lucas 1st ed. p. cm. Includes index. ISBN 1-59327-071-2 1. Electronic mail systems Security measures. 2. PGP (Computer file) I. Title: PGP and GPG. II. Title: Pretty good privacy & GnuPG. III. Title: Pretty good pri- vacy & GNU Privacy Guard. IV. Title: Email for the practical paranoid. V. Title. TK5102.85.L83 2006 004.692 dc22 2005028824 Liz: BEGIN PGP MESSAGE Version: GnuPG v1.4.0 (FreeBSD) hQIOA9o0ykGmcZmnEAf9Ed8ari4zo+6MZPLRMQ022AqbeNxuNsPKwvAeNGlDfDu7 iKYvFh3TtmBfeTK0RrvtU+nsaOlbOi4PrLLHLYSBZMPau0BIKKGPcG9162mqun4T 6R/qgwN7rzO6hqLqS+2knwA/U7KbjRJdwSMlyhU+wrmQI7RZFGutL7SOD2vQToUy sT3fuZX+qnhTdz3zA9DktIyjoz7q9N/MlicJa1SVhn42LR+DL2A7ruJXnNN2hi7g XbTFx9GaNMaDP1kbiXhm+rVByMHf4LTmteS4bavhGCbvY/dc4QKssinbgTvxzTlt 7CsdclLwvG8N+kOZXl/EHRXEC8B7R5l0p4x9mCI7zgf/Y3yPI85ZLCq79sN4/BCZ +Ycuz8YX14iLQD/hV2lGLwdkNzc3vQIvuBkwv6yq1zeKTVdgF/Yak6JqBnfVmH9q 8glbNZh3cpbuWk1xI4F/WDNqo8x0n0hsfiHtToICa2UvskqJWxDFhwTbb0UDiPbJ PJ2fgeOWFodASLVLolraaC6H2eR+k0lrbhYAIPsxMhGbYa13xZ0QVTOZ/KbVHBsP h27GXlq6SMwV6I4P69zVcFGueWQ7/dTfI3P+GvGm5zduivlmA8cM3Scbb/zW3ZIO 4eSdyxL9NaE03iBR0Fv9K8sKDttYDoZTsy6GQreFZPlcjfACn72s1Q6/QJmg8x1J SdJRAaPtzpBPCE85pK1a3qTgGuqAfDOHSYY2SgOEO7Er3w0XxGgWqtpZSDLEHDY+ 9MMJ0UEAhaOjqrBLiyP0cKmbqZHxJz1JbE1AcHw6A8F05cwW =zr4l END PGP MESSAGE BRIEF CONTENTS Acknowledgments xv Introduction 1 Chapter 1: Cryptography Kindergarten 13 Chapter 2: Understanding OpenPGP 27 Chapter 3: Installing PGP 39 Chapter 4: Installing GnuPG 53 Chapter 5: The Web of Trust 81 Chapter 6: PGP Key Management 91 Chapter 7: Managing GnuPG Keys 99 Chapter 8: OpenPGP and Email 11 5 Chapter 9: PGP and Email 12 5 Chapter 10: GnuPG and Email 13 7 Chapter 11: Other OpenPGP Considerations 15 5 Appendix A: Introduction to PGP Command Line 16 7 Appendix B: GnuPG Command Line Summary 17 7 Index 183 CONTENTS IN DETAIL ACKNOWLEDGMENTS xv INTRODUCTION 1 The Story of PGP 2 OpenPGP 4 How Secure Is OpenPGP? 5 Today ’s PGP Corporation 6 What Is GnuPG? 7 PGP Versus GnuPG 7 Ease of Use 7 Support 8 Transparency 9 Algorithm Support 9 OpenPGP and the Law 10 What This Book Contains 10 Stop Wasting My Precious Time. What Do I Need to Read? 11 1 CRYPTOGRAPHY KINDERGARTEN 13 What OpenPGP Can Do 13 Terminology 14 Plaintext and Ciphertext 15 Codes 15 Ciphers 16 Hashes 16 Cryptanalysis 17 Goals of PGP ’s Cryptography 17 Confidentiality 17 Integrity 17 Nonrepudiation 18 Authenticity 18 Encryption Algorithms 19 Symmetric Algorithms 20 Asymmetric Algorithms 21 Public-Key Encryption 22 Digital Signatures 22 x Contents in Detail Combining Signatures and Asymmetric Cryptography 23 Passphrases and Private Keys 24 Choosing a Passphrase 25 2 UNDERSTANDING OPENPGP 27 Security and OpenPGP 28 Web of Trust 29 Trust in OpenPGP 30 Where to Install 31 Your Keypair 32 Key Length 32 Key Expiration Date 33 Name, Email, and Comment 34 Revocation Certificates 35 Storing Your Keypair 35 Storing Your Revocation Certificate 36 Photo IDs and OpenPGP Keys 36 Key Distribution 36 Keyservers 37 3 INSTALLING PGP 39 Downloading PGP 40 Installing PGP 40 Key Type 42 Key Size 42 Expiration 42 Ciphers 42 Hashes 43 PGP Key Backups 45 Important Installation Locations 46 Revocation Certificates and PGP 46 Disabling Keyserver Updates 47 Revoke the Key 48 Re-import Your Private Key 49 Key Properties 50 Using the Revocation Certificate 51 Keyservers and PGP 51 4 INSTALLING GNUPG 53 Downloading GnuPG 54 Checking Checksums 54 Calculating Checksums Under Windows 55 Calculating Checksums Under Unix 55 GnuPG Home Directory 56 gpg.conf 57 [...]... The word PGP is used only for the PGP Corporation product If you see the word PGP, it means only that product and not GnuPG or any other implementation of OpenPGP The PGP folks will be unhappy with you if you call some other product PGP • The words GnuPG and GPG apply specifically to the Gnu Privacy Guard tool The GnuPG folks will be unhappy with you if you call their product PGP • The word OpenPGP applies... the PGP protocol and a variety of different encryption algorithms This led the way for people and companies to create their own implementations of OpenPGP from scratch, tailoring them to meet their own requirements How Secure Is OpenPGP? The OpenPGP standard is considered a military-grade, state-ofthe-art security system Although you see these words attached to all sorts of security products, OpenPGP... applies to PGP, GnuPG, and any other implementation of PGP Yes, there are other implementations of the OpenPGP standard out there Many vendors incorporate OpenPGP functionality into their products None are as wellknown or as accepted as PGP or GnuPG, however Nobody will be unhappy with you for calling their product OpenPGPcompliant Today’s PGP Corporation Today, PGP Corporation is a major player in the world... mathematical background All of this contributes to the air of mystery that surrounds encryption Doing the actual math behind modern encryption is admittedly quite difficult, but using the tools that do the work for you isn’t difficult at all once you have a rudimentary understanding of when to use which sort of encryption PGP & GPG: Email for the Practical Paranoid will take you step by step through the. .. Although PGP Corporation was owned by Network Associates for a few years during the dot-com boom, it is now an independent company with a variety of big-name industry partners PGP is a commercial product, and PGP Corporation provides a whole range of related support services We’re going to cover the basic version: the PGP Desktop (The corporate PGP solutions could fill a book on their own.) Because PGP is... allow enough time for most people to become comfortable with the tool Support afterward exists at whatever level you require, for a fee GnuPG’s support organization, on the other hand, is typical of free software Users are expected to read the software instructions, check the GnuPG website, and search the mailing list archives and the Internet before contacting the mailing list for help There is no phone... expected to pay for it 6 Introduction What Is GnuPG? GnuPG is a freely available implementation of the OpenPGP standard that was released to the public in 1999 by the German developer Werner Koch It is available for both Windows and Unix-like computers (including Mac OS X) Because GnuPG conforms to the OpenPGP standard, it can be used to communicate with people using any other OpenPGP-compliant software... information, there are easier ways for them to get it, so I would say that when properly configured and used, OpenPGP is sufficiently strong enough to make people choose another method of violating your privacy rather than try to break the encryption Introduction 5 TERMINOLOGY USAGE PGP, GPG, and OpenPGP? This could get confusing really quickly, so let’s set some definitions right at the beginning: • The. .. problems with it Discovering a problem in OpenPGP would be a sure-fire way to gain fame within the cryptography community, much as discovering how to build a 100-mile-per-gallon, high-performance gasoline engine would be in the auto industry Both seem impossible, but many people try However, both PGP and GnuPG are more than the algorithms used by OpenPGP There’s a whole bunch of source code in and around... IDEA, but the GnuPG folks won’t do it for you PGP Corporation has paid the patent holder, and when you buy PGP you get access to that cipher OpenPGP no longer requires IDEA, but some businesses might require it If you find a 10-year-old encrypted file you need to open, you’ll need IDEA Otherwise, it’s irrelevant OpenPGP and the Law OpenPGP uses some of the strongest public-key encryption algorithms available . CDN) 5 2 4 9 5 9 7 81 5 9 3 2 7 0 7 1 1 ISBN: 1-5 932 7-0 7 1-2 6 8 9 1 4 5 7 07 1 2 0 L UC A S PGP & GPG PGP & GPG PGP & GPG PGP & GPG E M A I L F O R T H E P R A C T I C A L P. directly or indirectly by the information contained in it. Library of Congress Cataloging-in-Publication Data Lucas, Michael, 196 7- PGP & GPG : email for the practical paranoid / Michael W THIS BO OK .” — LEN SASSA MAN , CO DECO N FOUN DER PGP & GPG Email for the Practical Paranoid by Michael W. Lucas San Francisco PGP & GPG. Copyright © 2006 by Michael W. Lucas. All rights