⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pubkey.but

📁 putty
💻 BUT
📖 第 1 页 / 共 2 页
字号:
\define{versionidpubkey} \versionid $Id: pubkey.but 6905 2006-11-15 12:56:48Z jacob $

\C{pubkey} Using public keys for SSH authentication

\H{pubkey-intro} \ii{Public key authentication} - an introduction

Public key authentication is an alternative means of identifying
yourself to a login server, instead of typing a password. It is more
secure and more flexible, but more difficult to set up.

In conventional password authentication, you prove you are who you
claim to be by proving that you know the correct password. The only
way to prove you know the password is to tell the server what you
think the password is. This means that if the server has been
hacked, or \i\e{spoofed} (see \k{gs-hostkey}), an attacker can learn
your password.

Public key authentication solves this problem. You generate a \i\e{key
pair}, consisting of a \i{public key} (which everybody is allowed to
know) and a \i{private key} (which you keep secret and do not give to
anybody). The private key is able to generate \i\e{signatures}.
A signature created using your private key cannot be forged by
anybody who does not have that key; but anybody who has your public
key can verify that a particular signature is genuine.

So you generate a key pair on your own computer, and you copy the
public key to the server. Then, when the server asks you to prove
who you are, PuTTY can generate a signature using your private key.
The server can verify that signature (since it has your public key)
and allow you to log in. Now if the server is hacked or spoofed, the
attacker does not gain your private key or password; they only gain
one signature. And signatures cannot be re-used, so they have gained
nothing.

There is a problem with this: if your private key is stored
unprotected on your own computer, then anybody who gains access to
\e{that} will be able to generate signatures as if they were you. So
they will be able to log in to your server under your account. For
this reason, your private key is usually \i\e{encrypted} when it is
stored on your local machine, using a \i{passphrase} of your choice. In
order to generate a signature, PuTTY must decrypt the key, so you
have to type your passphrase.

This can make public-key authentication less convenient than
password authentication: every time you log in to the server,
instead of typing a short password, you have to type a longer
passphrase. One solution to this is to use an \i\e{authentication
agent}, a separate program which holds decrypted private keys and
generates signatures on request. PuTTY's authentication agent is
called \i{Pageant}. When you begin a Windows session, you start Pageant
and load your private key into it (typing your passphrase once). For
the rest of your session, you can start PuTTY any number of times
and Pageant will automatically generate signatures without you
having to do anything. When you close your Windows session, Pageant
shuts down, without ever having stored your decrypted private key on
disk. Many people feel this is a good compromise between security
and convenience. See \k{pageant} for further details.

There is more than one \i{public-key algorithm} available. The most
common is \i{RSA}, but others exist, notably \i{DSA} (otherwise known as
DSS), the USA's federal Digital Signature Standard. The key types
supported by PuTTY are described in \k{puttygen-keytype}.

\H{pubkey-puttygen} Using \i{PuTTYgen}, the PuTTY key generator

\cfg{winhelp-topic}{puttygen.general}

PuTTYgen is a key generator. It \I{generating keys}generates pairs of
public and private keys to be used with PuTTY, PSCP, and Plink, as well
as the PuTTY authentication agent, Pageant (see \k{pageant}).  PuTTYgen
generates RSA and DSA keys.

When you run PuTTYgen you will see a window where you have two
choices: \q{Generate}, to generate a new public/private key pair, or
\q{Load} to load in an existing private key.

\S{puttygen-generating} Generating a new key

This is a general outline of the procedure for generating a new key
pair. The following sections describe the process in more detail.

\b First, you need to select which type of key you want to generate,
and also select the strength of the key. This is described in more
detail in \k{puttygen-keytype} and
\k{puttygen-strength}.

\b Then press the \q{Generate} button, to actually generate the key.
\K{puttygen-generate} describes this step.

\b Once you have generated the key, select a comment field
(\k{puttygen-comment}) and a passphrase (\k{puttygen-passphrase}).

\b Now you're ready to save the private key to disk; press the
\q{Save private key} button. (See \k{puttygen-savepriv}).

Your key pair is now ready for use. You may also want to copy the
public key to your server, either by copying it out of the \q{Public
key for pasting into authorized_keys file} box (see
\k{puttygen-pastekey}), or by using the \q{Save public key} button
(\k{puttygen-savepub}). However, you don't need to do this
immediately; if you want, you can load the private key back into
PuTTYgen later (see \k{puttygen-load}) and the public key will be
available for copying and pasting again.

\K{pubkey-gettingready} describes the typical process of configuring
PuTTY to attempt public-key authentication, and configuring your SSH
server to accept it.

\S{puttygen-keytype} Selecting the type of key

\cfg{winhelp-topic}{puttygen.keytype}

Before generating a key pair using PuTTYgen, you need to select
which type of key you need. PuTTYgen currently supports three types
of key:

\b An \i{RSA} key for use with the SSH-1 protocol.

\b An RSA key for use with the SSH-2 protocol.

\b A \i{DSA} key for use with the SSH-2 protocol.

The SSH-1 protocol only supports RSA keys; if you will be connecting
using the SSH-1 protocol, you must select the first key type or your
key will be completely useless.

The SSH-2 protocol supports more than one key type. The two types
supported by PuTTY are RSA and DSA.

The PuTTY developers \e{strongly} recommend you use RSA.
\I{security risk}\i{DSA} has an intrinsic weakness which makes it very
easy to create a signature which contains enough information to give
away the \e{private} key!
This would allow an attacker to pretend to be you for any number of
future sessions. PuTTY's implementation has taken very careful
precautions to avoid this weakness, but we cannot be 100% certain we
have managed it, and if you have the choice we strongly recommend
using RSA keys instead.

If you really need to connect to an SSH server which only supports
DSA, then you probably have no choice but to use DSA. If you do use
DSA, we recommend you do not use the same key to authenticate with
more than one server.

\S{puttygen-strength} Selecting the size (strength) of the key

\cfg{winhelp-topic}{puttygen.bits}

The \q{Number of bits} input box allows you to choose the strength
of the key PuTTYgen will generate.

Currently 1024 bits should be sufficient for most purposes.

Note that an RSA key is generated by finding two primes of half the
length requested, and then multiplying them together. For example,
if you ask PuTTYgen for a 1024-bit RSA key, it will create two
512-bit primes and multiply them. The result of this multiplication
might be 1024 bits long, or it might be only 1023; so you may not
get the exact length of key you asked for. This is perfectly normal,
and you do not need to worry. The lengths should only ever differ by
one, and there is no perceptible drop in security as a result.

DSA keys are not created by multiplying primes together, so they
should always be exactly the length you asked for.

\S{puttygen-generate} The \q{Generate} button

\cfg{winhelp-topic}{puttygen.generate}

Once you have chosen the type of key you want, and the strength of
the key, press the \q{Generate} button and PuTTYgen will begin the
process of actually generating the key.

First, a progress bar will appear and PuTTYgen will ask you to move
the mouse around to generate randomness. Wave the mouse in circles
over the blank area in the PuTTYgen window, and the progress bar
will gradually fill up as PuTTYgen collects enough randomness. You
don't need to wave the mouse in particularly imaginative patterns
(although it can't hurt); PuTTYgen will collect enough randomness
just from the fine detail of \e{exactly} how far the mouse has moved
each time Windows samples its position.

When the progress bar reaches the end, PuTTYgen will begin creating
the key. The progress bar will reset to the start, and gradually
move up again to track the progress of the key generation. It will
not move evenly, and may occasionally slow down to a stop; this is
unfortunately unavoidable, because key generation is a random
process and it is impossible to reliably predict how long it will
take.

When the key generation is complete, a new set of controls will
appear in the window to indicate this.

\S{puttygen-fingerprint} The \q{\ii{Key fingerprint}} box

\cfg{winhelp-topic}{puttygen.fingerprint}

The \q{Key fingerprint} box shows you a fingerprint value for the
generated key. This is derived cryptographically from the \e{public}
key value, so it doesn't need to be kept secret.

The fingerprint value is intended to be cryptographically secure, in
the sense that it is computationally infeasible for someone to
invent a second key with the same fingerprint, or to find a key with
a particular fingerprint. So some utilities, such as the Pageant key
list box (see \k{pageant-mainwin-keylist}) and the Unix \c{ssh-add}
utility, will list key fingerprints rather than the whole public key.

\S{puttygen-comment} Setting a comment for your key

\cfg{winhelp-topic}{puttygen.comment}

If you have more than one key and use them for different purposes,
you don't need to memorise the key fingerprints in order to tell
them apart. PuTTYgen allows you to enter a \e{comment} for your key,
which will be displayed whenever PuTTY or Pageant asks you for the
passphrase.

The default comment format, if you don't specify one, contains the
key type and the date of generation, such as \c{rsa-key-20011212}.
Another commonly used approach is to use your name and the name of
the computer the key will be used on, such as \c{simon@simons-pc}.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -