Sie sind auf Seite 1von 2

GPG/PGP Basics Public key, private key

The basic concept is this: You generate a pair of matched keys. One of these is referred to as your "Public" key, and the other as "Private". You give the Public key to anyone who asks for it; you can even publish it on your web site. You keep your Private key secret, locked up on your own computer. A document (a text or binary file) can be encrypted using either key, and is decrypted with the other. The choice of which key to use to encrypt depends upon your purpose. For example, if you want to send me something, you'd encrypt it using my public key. No one else can decrypt it; only my private key will work. On the other hand, I might be concerned that it really is you sending me a message. In that case, you'd encrypt your message using your private key (this is called "signing"). If I can decrypt it with your public key (presumably I somehow obtained that key and trust that it really is yours), I know that the message really came from you.

An example
You can test this all out on one computer using two (or more) user accounts. I'm going to assume that user "tom" wants to send an encrypted message to user "marge". The first thing Marge needs to do is generate her keys:

[marge@apl marge]$ gpg --gen-key gpg (GnuPG) 1.0.6; Copyright (C) 2001 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. gpg: gpg: gpg: gpg: Warning: using insecure memory! /home/marge/.gnupg: directory created /home/marge/.gnupg/options: new options file created you have to start GnuPG again, so it can read the new options file

Because Marge has never created a key before, gpg just creates what it needs and tells her to run it again:

[marge@apl marge]$ gpg --gen-key gpg (GnuPG) 1.0.6; Copyright (C) 2001 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. gpg: Warning: using insecure memory! gpg: /home/marge/.gnupg/secring.gpg: keyring created gpg: /home/marge/.gnupg/pubring.gpg: keyring created Please select what kind of key you want: (1) DSA and ElGamal (default) (2) DSA (sign only) (4) ElGamal (sign and encrypt) Your selection? 1

DSA keypair will have 1024 bits. About to generate a new ELG-E keypair. minimum keysize is 768 bits default keysize is 1024 bits highest suggested keysize is 2048 bits What keysize do you want? (1024) Requested keysize is 1024 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct (y/n)? y You need a User-ID to identify your key; the software constructs the user id from Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>" Real name: Marge Email address: marge@aplawrence.com Comment: Marge's GPG key pair You selected this USER-ID: "Marge (Marge's GPG key pair) <marge@aplawrence.com>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key. Enter passphrase: Sbr6wh wscartBM, iscaa2d Repeat passphrase: Sbr6wh wscartBM, iscaa2d We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. .+++++++++++++++++++++++++.+++++++++++++++..++++++++++++++++ +++++++++++++++++++....++++++++++.++++++++++++++++++++++++++ ++++.+++++.++++++++++>++++++++++>++++++++++ public and secret key created and signed.
(See Random Numbers also) The passphrase entered should be a tough password. It can contain spaces, there's no limit on its length, but of course you will need to remember it. I use mnemonic aids to generate passwords and passphrases. For example, the passphrase above comes from this: She'll be riding six white horses when she comes around that Big Mountain, if she comes at all today

Das könnte Ihnen auch gefallen