pubkey.but 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. \C{pubkey} Using public keys for SSH authentication
  2. \H{pubkey-intro} \ii{Public key authentication} - an introduction
  3. Public key authentication is an alternative means of identifying
  4. yourself to a login server, instead of typing a password. It is more
  5. secure and more flexible, but more difficult to set up.
  6. In conventional password authentication, you prove you are who you
  7. claim to be by proving that you know the correct password. The only
  8. way to prove you know the password is to tell the server what you
  9. think the password is. This means that if the server has been
  10. hacked, or \i\e{spoofed} (see \k{gs-hostkey}), an attacker can learn
  11. your password.
  12. Public key authentication solves this problem. You generate a \i\e{key
  13. pair}, consisting of a \i{public key} (which everybody is allowed to
  14. know) and a \i{private key} (which you keep secret and do not give to
  15. anybody). The private key is able to generate \i\e{signatures}.
  16. A signature created using your private key cannot be forged by
  17. anybody who does not have that key; but anybody who has your public
  18. key can verify that a particular signature is genuine.
  19. So you generate a key pair on your own computer, and you copy the
  20. public key to the server. Then, when the server asks you to prove
  21. who you are, PuTTY can generate a signature using your private key.
  22. The server can verify that signature (since it has your public key)
  23. and allow you to log in. Now if the server is hacked or spoofed, the
  24. attacker does not gain your private key or password; they only gain
  25. one signature. And signatures cannot be re-used, so they have gained
  26. nothing.
  27. There is a problem with this: if your private key is stored
  28. unprotected on your own computer, then anybody who gains access to
  29. \e{that} will be able to generate signatures as if they were you. So
  30. they will be able to log in to your server under your account. For
  31. this reason, your private key is usually \i\e{encrypted} when it is
  32. stored on your local machine, using a \i{passphrase} of your choice. In
  33. order to generate a signature, PuTTY must decrypt the key, so you
  34. have to type your passphrase.
  35. This can make public-key authentication less convenient than
  36. password authentication: every time you log in to the server,
  37. instead of typing a short password, you have to type a longer
  38. passphrase. One solution to this is to use an \i\e{authentication
  39. agent}, a separate program which holds decrypted private keys and
  40. generates signatures on request. PuTTY's authentication agent is
  41. called \i{Pageant}. When you begin a Windows session, you start Pageant
  42. and load your private key into it (typing your passphrase once). For
  43. the rest of your session, you can start PuTTY any number of times
  44. and Pageant will automatically generate signatures without you
  45. having to do anything. When you close your Windows session, Pageant
  46. shuts down, without ever having stored your decrypted private key on
  47. disk. Many people feel this is a good compromise between security
  48. and convenience. See \k{pageant} for further details.
  49. There is more than one \i{public-key algorithm} available. The most
  50. common are \i{RSA} and \i{ECDSA}, but others exist, notably \i{DSA}
  51. (otherwise known as \i{DSS}), the USA's federal Digital Signature Standard.
  52. The key types supported by PuTTY are described in \k{puttygen-keytype}.
  53. \H{pubkey-puttygen} Using \i{PuTTYgen}, the PuTTY key generator
  54. PuTTYgen is a key generator. It \I{generating keys}generates pairs of
  55. public and private keys to be used with PuTTY, PSCP, PSFTP, and Plink,
  56. as well as the PuTTY authentication agent, Pageant (see \k{pageant}).
  57. PuTTYgen generates RSA, DSA, ECDSA, and EdDSA keys.
  58. When you run PuTTYgen you will see a window where you have two main
  59. choices: \q{Generate}, to generate a new public/private key pair, or
  60. \q{Load} to load in an existing private key.
  61. \S{puttygen-generating} Generating a new key
  62. This is a general outline of the procedure for generating a new key
  63. pair. The following sections describe the process in more detail.
  64. \b First, you need to select which type of key you want to generate,
  65. and also select the strength of the key. This is described in more
  66. detail in \k{puttygen-keytype} and
  67. \k{puttygen-strength}.
  68. \b Then press the \q{Generate} button, to actually generate the key.
  69. \K{puttygen-generate} describes this step.
  70. \b Once you have generated the key, select a comment field
  71. (\k{puttygen-comment}) and a passphrase (\k{puttygen-passphrase}).
  72. \b Now you're ready to save the private key to disk; press the
  73. \q{Save private key} button. (See \k{puttygen-savepriv}).
  74. Your key pair is now ready for use. You may also want to copy the
  75. public key to your server, either by copying it out of the \q{Public
  76. key for pasting into OpenSSH authorized_keys file} box (see
  77. \k{puttygen-pastekey}), or by using the \q{Save public key} button
  78. (\k{puttygen-savepub}). However, you don't need to do this
  79. immediately; if you want, you can load the private key back into
  80. PuTTYgen later (see \k{puttygen-load}) and the public key will be
  81. available for copying and pasting again.
  82. \K{pubkey-gettingready} describes the typical process of configuring
  83. PuTTY to attempt public-key authentication, and configuring your SSH
  84. server to accept it.
  85. \S{puttygen-keytype} Selecting the type of key
  86. Before generating a key pair using PuTTYgen, you need to select
  87. which type of key you need.
  88. The current version of the SSH protocol, SSH-2, supports several
  89. different key types, although specific servers may not support all of
  90. them. PuTTYgen can generate:
  91. \b An \i{RSA} key for use with the SSH-2 protocol.
  92. \b A \i{DSA} key for use with the SSH-2 protocol.
  93. \b An \i{ECDSA} (\i{elliptic curve} DSA) key for use with the
  94. SSH-2 protocol.
  95. \b An \i{EdDSA} key (Edwards-curve DSA, another elliptic curve
  96. algorithm) for use with the SSH-2 protocol.
  97. PuTTYgen can also generate an RSA key suitable for use with the old
  98. SSH-1 protocol (which only supports RSA); for this, you need to select
  99. the \q{SSH-1 (RSA)} option. Since the SSH-1 protocol is no longer
  100. considered secure, it's rare to need this option.
  101. \S{puttygen-strength} Selecting the size (strength) of the key
  102. The \q{Number of bits} input box allows you to choose the strength
  103. of the key PuTTYgen will generate.
  104. \b For RSA and DSA, 2048 bits should currently be sufficient for most
  105. purposes. (Smaller keys of these types are no longer considered
  106. secure, and PuTTYgen will warn if you try to generate them.)
  107. \b For ECDSA, only 256, 384, and 521 bits are supported, corresponding
  108. to \i{NIST}-standardised elliptic curves. (Elliptic-curve keys do not
  109. need as many bits as RSA keys for equivalent security, so these numbers
  110. are smaller than the RSA recommendations.)
  111. \b For EdDSA, the only valid sizes are 255 bits (these keys are also
  112. known as \q{\i{Ed25519}} and are commonly used) and 448 bits
  113. (\q{\i{Ed448}}, which is much less common at the time of writing).
  114. (256 is also accepted for backward compatibility, but the effect is
  115. the same as 255.)
  116. \S{puttygen-primes} Selecting the \i{prime generation method}
  117. (This is entirely optional. Unless you know better, it's entirely
  118. sensible to skip this and use the default settings.)
  119. On the \q{Key} menu, you can also optionally change the method for
  120. generating the prime numbers used in the generated key. This is used
  121. for RSA and DSA keys only. (The other key types don't require
  122. generating prime numbers at all.)
  123. The prime-generation method does not affect compatibility: a key
  124. generated with any of these methods will still work with all the same
  125. SSH servers.
  126. The available methods are:
  127. \b Use \i{probable primes} (fast)
  128. \b Use \i{proven primes} (slower)
  129. \b Use proven primes with even distribution (slowest)
  130. The \q{probable primes} method sounds unsafe, but it's the most
  131. commonly used prime-generation strategy. There is in theory a
  132. possibility that it might accidentally generate a number that isn't
  133. prime, but the software does enough checking to make that probability
  134. vanishingly small (less than 1 in 2^80, or 1 in 10^24). So, in
  135. practice, nobody worries about it very much.
  136. The other methods cause PuTTYgen to use numbers that it is \e{sure}
  137. are prime, because it generates the output number together with a
  138. proof of its primality. This takes more effort, but it eliminates that
  139. theoretical risk in the probabilistic method.
  140. There in one way in which PuTTYgen's \q{proven primes} method is not
  141. strictly better than its \q{probable primes} method. If you use
  142. PuTTYgen to generate an RSA key on a computer that is potentially
  143. susceptible to timing- or cache-based \i{side-channel attacks}, such
  144. as a shared computer, the \q{probable primes} method is designed to
  145. resist such attacks, whereas the \q{proven primes} methods are not.
  146. (This is only a concern for RSA keys; for other key types, primes
  147. are either not secret or not involved.)
  148. You might choose to switch from probable to proven primes if you have
  149. a local security standard that demands it, or if you don't trust the
  150. probabilistic argument for the safety of the usual method.
  151. For RSA keys, there's also an option on the \q{Key} menu to use
  152. \i{\q{strong} primes} as the prime factors of the public key. A \q{strong}
  153. prime is a prime number chosen to have a particular structure that
  154. makes certain factoring algorithms more difficult to apply, so some
  155. security standards recommend their use. However, the most modern
  156. factoring algorithms are unaffected, so this option is probably not
  157. worth turning on \e{unless} you have a local standard that recommends
  158. it.
  159. \S{puttygen-generate} The \q{Generate} button
  160. Once you have chosen the type of key you want, and the strength of
  161. the key, press the \q{Generate} button and PuTTYgen will begin the
  162. process of actually generating the key.
  163. First, a progress bar will appear and PuTTYgen will ask you to move
  164. the mouse around to generate randomness. Wave the mouse in circles
  165. over the blank area in the PuTTYgen window, and the progress bar
  166. will gradually fill up as PuTTYgen collects enough randomness. You
  167. don't need to wave the mouse in particularly imaginative patterns
  168. (although it can't hurt); PuTTYgen will collect enough randomness
  169. just from the fine detail of \e{exactly} how far the mouse has moved
  170. each time Windows samples its position.
  171. When the progress bar reaches the end, PuTTYgen will begin creating
  172. the key. The progress bar will reset to the start, and gradually
  173. move up again to track the progress of the key generation. It will
  174. not move evenly, and may occasionally slow down to a stop; this is
  175. unfortunately unavoidable, because key generation is a random
  176. process and it is impossible to reliably predict how long it will
  177. take.
  178. When the key generation is complete, a new set of controls will
  179. appear in the window to indicate this.
  180. \S{puttygen-fingerprint} The \q{\ii{Key fingerprint}} box
  181. The \q{Key fingerprint} box shows you a fingerprint value for the
  182. generated key. This is derived cryptographically from the \e{public}
  183. key value, so it doesn't need to be kept secret; it is supposed to
  184. be more manageable for human beings than the public key itself.
  185. The fingerprint value is intended to be cryptographically secure, in
  186. the sense that it is computationally infeasible for someone to
  187. invent a second key with the same fingerprint, or to find a key with
  188. a particular fingerprint. So some utilities, such as the Pageant key
  189. list box (see \k{pageant-mainwin-keylist}) and the Unix \c{ssh-add}
  190. utility, will list key fingerprints rather than the whole public key.
  191. By default, PuTTYgen will display SSH-2 key fingerprints in the
  192. \q{SHA256} format. If you need to see the fingerprint in the older
  193. \q{MD5} format (which looks like \c{aa:bb:cc:...}), you can choose
  194. \q{Show fingerprint as MD5} from the \q{Key} menu, but bear in mind
  195. that this is less cryptographically secure; it may be feasible for
  196. an attacker to create a key with the same fingerprint as yours.
  197. \S{puttygen-comment} Setting a comment for your key
  198. If you have more than one key and use them for different purposes,
  199. you don't need to memorise the key fingerprints in order to tell
  200. them apart. PuTTYgen allows you to enter a \e{comment} for your key,
  201. which will be displayed whenever PuTTY or Pageant asks you for the
  202. passphrase.
  203. The default comment format, if you don't specify one, contains the
  204. key type and the date of generation, such as \c{rsa-key-20011212}.
  205. Another commonly used approach is to use your name and the name of
  206. the computer the key will be used on, such as \c{simon@simons-pc}.
  207. To alter the key comment, just type your comment text into the
  208. \q{Key comment} box before saving the private key. If you want to
  209. change the comment later, you can load the private key back into
  210. PuTTYgen, change the comment, and save it again.
  211. \S{puttygen-passphrase} Setting a \i{passphrase} for your key
  212. The \q{Key passphrase} and \q{Confirm passphrase} boxes allow you to
  213. choose a passphrase for your key. The passphrase will be used to
  214. \i{encrypt} the key on disk, so you will not be able to use the key
  215. without first entering the passphrase.
  216. When you save the key, PuTTYgen will check that the \q{Key passphrase}
  217. and \q{Confirm passphrase} boxes both contain exactly the same
  218. passphrase, and will refuse to save the key otherwise.
  219. If you leave the passphrase fields blank, the key will be saved
  220. unencrypted. You should \e{not} do this without good reason; if you
  221. do, your private key file on disk will be all an attacker needs to
  222. gain access to any machine configured to accept that key. If you
  223. want to be able to \I{passwordless login}log in without having to
  224. type a passphrase every time, you should consider using Pageant
  225. (\k{pageant}) so that your decrypted key is only held in memory
  226. rather than on disk.
  227. Under special circumstances you may genuinely \e{need} to use a key
  228. with no passphrase; for example, if you need to run an automated
  229. batch script that needs to make an SSH connection, you can't be
  230. there to type the passphrase. In this case we recommend you generate
  231. a special key for each specific batch script (or whatever) that
  232. needs one, and on the server side you should arrange that each key
  233. is \e{restricted} so that it can only be used for that specific
  234. purpose. The documentation for your SSH server should explain how to
  235. do this (it will probably vary between servers).
  236. Choosing a good passphrase is difficult. Just as you shouldn't use a
  237. dictionary word as a password because it's easy for an attacker to
  238. run through a whole dictionary, you should not use a song lyric,
  239. quotation or other well-known sentence as a passphrase. \i{DiceWare}
  240. (\W{http://www.diceware.com/}\cw{www.diceware.com}) recommends using
  241. at least five words each generated randomly by rolling five dice,
  242. which gives over 2^64 possible passphrases and is probably not a bad
  243. scheme. If you want your passphrase to make grammatical sense, this
  244. cuts down the possibilities a lot and you should use a longer one as
  245. a result.
  246. \e{Do not forget your passphrase}. There is no way to recover it.
  247. \S{puttygen-cert} Adding a \i{certificate} to your key
  248. In some environments, user authentication keys can be signed in turn
  249. by a \q{certifying authority} (\q{CA} for short), and user accounts on
  250. an SSH server can be configured to automatically trust any key that's
  251. certified by the right signature.
  252. This can be a convenient setup if you have a very large number of
  253. servers. When you change your key pair, you might otherwise have to
  254. edit the \cw{authorized_keys} file on every server individually, to
  255. make them all accept the new key. But if instead you configure all
  256. those servers \e{once} to accept keys signed as yours by a CA, then
  257. when you change your public key, all you have to do is to get the new
  258. key certified by the same CA as before, and then all your servers will
  259. automatically accept it without needing individual reconfiguration.
  260. To get your key signed by a CA, you'll probably send the CA the new
  261. \e{public} key (not the private half), and get back a modified version
  262. of the public key with the certificate included.
  263. If you want to incorporate the certificate into your PPK file for
  264. convenience, you can use the \q{Add certificate to key} menu option in
  265. PuTTYgen's \q{Key} menu. This will give you a single file containing
  266. your private key and the certificate, which is everything you need to
  267. authenticate to a server prepared to accept that certificate.
  268. To remove the certificate again and restore the uncertified PPK file,
  269. there's also a \q{Remove certificate from key} option.
  270. (However, you don't \e{have} to incorporate the certificate into your
  271. PPK file. You can equally well use it separately, via the
  272. \q{Certificate to use with the private key} option in PuTTY itself.
  273. See \k{config-ssh-cert}. It's up to you which you find more
  274. convenient.)
  275. When the currently loaded key in PuTTYgen contains a certificate, the
  276. large \q{Public key for pasting} edit box (see \k{puttygen-pastekey})
  277. is replaced by a button that brings up an information box telling you
  278. about the certificate, such as who it certifies your key as belonging
  279. to, when it expires (if ever), and the fingerprint of the CA key that
  280. signed it in turn.
  281. \S{puttygen-savepriv} Saving your private key to a disk file
  282. Once you have generated a key, set a comment field and set a
  283. passphrase, you are ready to save your private key to disk.
  284. Press the \q{Save private key} button. PuTTYgen will put up a dialog
  285. box asking you where to save the file. Select a directory, type in a
  286. file name, and press \q{Save}.
  287. This file is in PuTTY's native format (\c{*.\i{PPK}}); it is the one you
  288. will need to tell PuTTY to use for authentication (see
  289. \k{config-ssh-privkey}) or tell Pageant to load (see
  290. \k{pageant-mainwin-addkey}).
  291. (You can optionally change some details of the PPK format for your saved
  292. key files; see \k{puttygen-save-params}. But the defaults should be
  293. fine for most purposes.)
  294. \S{puttygen-savepub} Saving your public key to a disk file
  295. RFC 4716 specifies a \I{SSH-2 public key format}standard format for
  296. storing SSH-2 public keys on disk. Some SSH servers (such as
  297. \i\cw{ssh.com}'s) require a public key in this format in order to accept
  298. authentication with the corresponding private key. (Others, such as
  299. OpenSSH, use a different format; see \k{puttygen-pastekey}.)
  300. To save your public key in the SSH-2 standard format, press the
  301. \q{Save public key} button in PuTTYgen. PuTTYgen will put up a
  302. dialog box asking you where to save the file. Select a directory,
  303. type in a file name, and press \q{Save}.
  304. You will then probably want to copy the public key file to your SSH
  305. server machine. See \k{pubkey-gettingready} for general instructions
  306. on configuring public-key authentication once you have generated a
  307. key.
  308. If you use this option with an SSH-1 key, the file PuTTYgen saves
  309. will contain exactly the same text that appears in the \q{Public key
  310. for pasting} box. This is the only existing standard for SSH-1
  311. public keys.
  312. \S{puttygen-pastekey} \q{Public key for pasting into OpenSSH
  313. \i{authorized_keys file}}
  314. The \i{OpenSSH} server, among others, requires your public key to be
  315. given to it in a one-line format before it will accept authentication
  316. with your private key. (SSH-1 servers also used this method.)
  317. The \q{Public key for pasting into OpenSSH authorized_keys file} gives the
  318. public-key data in the correct one-line format. Typically you will
  319. want to select the entire contents of the box using the mouse, press
  320. Ctrl+C to copy it to the clipboard, and then paste the data into a
  321. PuTTY session which is already connected to the server.
  322. See \k{pubkey-gettingready} for general instructions on configuring
  323. public-key authentication once you have generated a key.
  324. \S{puttygen-save-params} Parameters for saving key files
  325. Selecting \q{Parameters for saving key files...} from the \q{Key} menu
  326. lets you adjust some aspects of PPK-format private key files stored on
  327. disk. None of these options affect compatibility with SSH servers.
  328. In most cases, it's entirely sensible to leave all of these at their
  329. default settings.
  330. \S2{puttygen-save-ppk-version} PPK file version
  331. This defaults to version 3, which is fine for most uses.
  332. You might need to select PPK version 2 if you need your private key
  333. file to be loadable in older versions of PuTTY (0.74 and older), or in
  334. other tools which do not yet support the version 3 format (which was
  335. introduced in 2021).
  336. The version 2 format is less resistant to brute-force decryption, and
  337. doesn't support any of the following options to control that.
  338. \S2{puttygen-save-passphrase-hashing} Options affecting \i{passphrase hashing}
  339. All of the following options only affect keys saved with passphrases.
  340. They control how much work is required to decrypt the key (which
  341. happens every time you type its passphrase). This allows you to trade
  342. off the cost of legitimate use of the key against the resistance of
  343. the encrypted key to password-guessing attacks.
  344. These options only affect PPK version 3.
  345. \dt Key derivation function
  346. \dd The variant of the \i{Argon2} key derivation function to use.
  347. You might change this if you consider your exposure to \i{side-channel
  348. attacks} to be different to the norm.
  349. \dt Memory to use for passphrase hash
  350. \dd The amount of memory needed to decrypt the key, in Kbyte.
  351. \dt Time to use for passphrase hash
  352. \dd Controls how much time is required to attempt decrypting the key.
  353. You can either specify an approximate time in milliseconds (on this
  354. machine), or explicitly specify a number of hash passes (which is what
  355. the time is turned into during encryption).
  356. \dt Parallelism for passphrase hash
  357. \dd Number of parallelisable threads that can be used to decrypt the
  358. key. The default, 1, forces the process to run single-threaded, even
  359. on machines with multiple cores.
  360. \S{puttygen-load} Reloading a private key
  361. PuTTYgen allows you to load an existing private key file into
  362. memory. If you do this, you can then change the passphrase and
  363. comment before saving it again; you can also make extra copies of
  364. the public key.
  365. To load an existing key, press the \q{Load} button. PuTTYgen will
  366. put up a dialog box where you can browse around the file system and
  367. find your key file. Once you select the file, PuTTYgen will ask you
  368. for a passphrase (if necessary) and will then display the key
  369. details in the same way as if it had just generated the key.
  370. If you use the Load command to load a foreign key format, it will
  371. work, but you will see a message box warning you that the key you
  372. have loaded is not a PuTTY native key. See \k{puttygen-conversions}
  373. for information about importing foreign key formats.
  374. \S{puttygen-conversions} Dealing with private keys in other formats
  375. SSH-2 private keys have no standard format. \I{OpenSSH private
  376. key format}OpenSSH and \I{ssh.com private key format}\cw{ssh.com} have
  377. different formats, and PuTTY's is different again.
  378. So a key generated with one client cannot immediately be used with
  379. another.
  380. Using the \I{importing keys}\q{Import} command from the \q{Conversions}
  381. menu, PuTTYgen can load SSH-2 private keys in OpenSSH's format and
  382. \cw{ssh.com}'s format. Once you have loaded one of these key types, you
  383. can then save it back out as a PuTTY-format key (\c{*.\i{PPK}}) so that
  384. you can use it with the PuTTY suite. The passphrase will be unchanged by this
  385. process (unless you deliberately change it). You may want to change
  386. the key comment before you save the key, since some OpenSSH key
  387. formats contained no space for a comment, and \cw{ssh.com}'s default
  388. comment format is long and verbose.
  389. PuTTYgen can also \i{export private keys} in OpenSSH format and in
  390. \cw{ssh.com} format. To do so, select one of the \q{Export} options
  391. from the \q{Conversions} menu. Exporting a key works exactly like
  392. saving it (see \k{puttygen-savepriv}) - you need to have typed your
  393. passphrase in beforehand, and you will be warned if you are about to
  394. save a key without a passphrase.
  395. For OpenSSH there are two options. Modern OpenSSH actually has two
  396. formats it uses for storing private keys: an older (\q{\i{PEM-style}})
  397. format, and a newer \q{native} format with better resistance to
  398. passphrase guessing and support for comments. \q{Export OpenSSH key}
  399. will automatically choose the oldest format supported for the key
  400. type, for maximum backward compatibility with older versions of
  401. OpenSSH; for newer key types like Ed25519, it will use the newer
  402. format as that is the only legal option. If you have some specific
  403. reason for wanting to use OpenSSH's newer format even for RSA, DSA,
  404. or ECDSA keys \dash for instance, you know your file will only be
  405. used by OpenSSH 6.5 or newer (released in 2014), and want the extra
  406. security \dash you can choose \q{Export OpenSSH key (force new file
  407. format)}.
  408. Most clients for the older SSH-1 protocol use a standard format for
  409. storing private keys on disk. PuTTY uses this format as well; so if
  410. you have generated an SSH-1 private key using OpenSSH or
  411. \cw{ssh.com}'s client, you can use it with PuTTY, and vice versa.
  412. Hence, the export options are not available if you have generated an
  413. SSH-1 key.
  414. \S{puttygen-cli} PuTTYgen command-line configuration
  415. PuTTYgen supports a set of command-line options to configure many of
  416. the same settings you can select in the GUI. This allows you to start
  417. it up with your own preferences ready-selected, which might be useful
  418. if you generate a lot of keys. (For example, you could make a Windows
  419. shortcut that runs PuTTYgen with some command line options, or a batch
  420. file or Powershell script that you could distribute to a whole
  421. organisation containing your local standards.)
  422. The options supported on the command line are:
  423. \dt \cw{\-t} \e{keytype}
  424. \dd Type of key to generate. You can select \c{rsa}, \c{dsa},
  425. \c{ecdsa}, \c{eddsa}, \c{ed25519}, \c{ed448}, or \c{rsa1}.
  426. See \k{puttygen-keytype}.
  427. \dt \cw{\-b} \e{bits}
  428. \dd Size of the key to generate, in bits. See \k{puttygen-strength}.
  429. \dt \cw{\-\-primes} \e{method}
  430. \dd Method for generating prime numbers. You can select \c{probable},
  431. \c{proven}, and \c{proven-even}. See \k{puttygen-primes}.
  432. \dt \cw{\-\-strong-rsa}
  433. \dd When generating an RSA key, make sure the prime factors of the key
  434. modulus are \q{strong primes}. See \k{puttygen-primes}.
  435. \dt \cw{\-\-ppk-param} \e{key}\cw{=}\e{value}\cw{,}...
  436. \dd Allows setting all the same details of the PPK save file format
  437. described in \k{puttygen-save-params}.
  438. \lcont{
  439. Aspects to change are specified as a series of \e{key}\cw{=}\e{value} pairs
  440. separated by commas. The \e{key}s are:
  441. \dt \cw{version}
  442. \dd The PPK format version: either \cw{3} or \cw{2}.
  443. \dt \cw{kdf}
  444. \dd The variant of Argon2 to use: \cw{argon2id}, \cw{argon2i}, and
  445. \cw{argon2d}.
  446. \dt \cw{memory}
  447. \dd The amount of memory needed to decrypt the key, in Kbyte.
  448. \dt \cw{time}
  449. \dd Specifies how much time is required to attempt decrypting the key,
  450. in milliseconds.
  451. \dt \cw{passes}
  452. \dd Alternative to \cw{time}: specifies the number of hash passes
  453. required to attempt decrypting the key.
  454. \dt \cw{parallelism}
  455. \dd Number of parallelisable threads that can be used to decrypt the
  456. key.
  457. }
  458. \dt \cw{\-E} \e{fptype}
  459. \dd Algorithm to use when displaying key fingerprints. You can
  460. select \c{sha256} or \c{md5}. See \k{puttygen-fingerprint}.
  461. \H{pubkey-gettingready} Getting ready for public key authentication
  462. Connect to your SSH server using PuTTY with the SSH protocol. When the
  463. connection succeeds you will be prompted for your user name and
  464. password to login. Once logged in, you must configure the server to
  465. accept your public key for authentication:
  466. \b If your server is \i{OpenSSH}, you should change into the
  467. \i\c{.ssh} directory under your home directory, and open the file
  468. \i\c{authorized_keys} with your favourite editor. (You may have to
  469. create this file, if this is the first key you have put in it.) Then
  470. switch to the PuTTYgen window, select all of the text in the \q{Public
  471. key for pasting into OpenSSH authorized_keys file} box (see
  472. \k{puttygen-pastekey}), and copy it to the clipboard (\c{Ctrl+C}).
  473. Then, switch back to the PuTTY window and insert the data into the
  474. open file, making sure it ends up all on one line. Save the file.
  475. \lcont{
  476. (In very old versions of OpenSSH, SSH-2 keys had to be put in a
  477. separate file called \c{authorized_keys2}. In all current versions,
  478. the same \c{authorized_keys} file is used for both SSH-1 and SSH-2 keys.)
  479. }
  480. \b If your server is \i\cw{ssh.com}'s product and is using SSH-2, you
  481. need to save a \e{public} key file from PuTTYgen (see
  482. \k{puttygen-savepub}), and copy that into the \i\c{.ssh2} directory on
  483. the server. Then you should go into that \c{.ssh2} directory, and edit
  484. (or create) a file called \c{authorization}. In this file you should
  485. put a line like \c{Key mykey.pub}, with \c{mykey.pub} replaced by the
  486. name of your key file.
  487. \b For other SSH server software, you should refer to the manual for
  488. that server.
  489. You may also need to ensure that your home directory, your \c{.ssh}
  490. directory, and any other files involved (such as
  491. \c{authorized_keys}, \c{authorized_keys2} or \c{authorization}) are
  492. not group-writable or world-writable; servers will typically ignore
  493. the keys unless this is done. You can typically do this by using a
  494. command such as
  495. \c chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys
  496. Your server should now be configured to accept authentication using
  497. your private key. Now you need to configure PuTTY to \e{attempt}
  498. authentication using your private key. You can do this in any of
  499. three ways:
  500. \b Select the private key in PuTTY's configuration. See
  501. \k{config-ssh-privkey} for details.
  502. \b Specify the key file on the command line with the \c{-i} option.
  503. See \k{using-cmdline-identity} for details.
  504. \b Load the private key into Pageant (see \k{pageant}). In this case
  505. PuTTY will automatically try to use it for authentication if it can.