1d4af9e69SDag-Erling Smørgrav.\" $OpenBSD: ssh-keygen.1,v 1.78 2008/06/12 19:10:09 jmc Exp $ 21e8db6e2SBrian Feldman.\" 3511b41d2SMark Murray.\" -*- nroff -*- 4511b41d2SMark Murray.\" 5511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 6511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7511b41d2SMark Murray.\" All rights reserved 8511b41d2SMark Murray.\" 9b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software 10b66f2d16SKris Kennaway.\" can be used freely for any purpose. Any derived versions of this 11b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is 12b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be 13b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell". 14511b41d2SMark Murray.\" 15b66f2d16SKris Kennaway.\" 16b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 17b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 18b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 19b66f2d16SKris Kennaway.\" 20b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without 21b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions 22b66f2d16SKris Kennaway.\" are met: 23b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright 24b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer. 25b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright 26b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer in the 27b66f2d16SKris Kennaway.\" documentation and/or other materials provided with the distribution. 28b66f2d16SKris Kennaway.\" 29b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 30b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 31b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 33b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 34b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 38b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39511b41d2SMark Murray.\" 40d4af9e69SDag-Erling Smørgrav.Dd $Mdocdate: June 12 2008 $ 41511b41d2SMark Murray.Dt SSH-KEYGEN 1 42511b41d2SMark Murray.Os 43511b41d2SMark Murray.Sh NAME 44511b41d2SMark Murray.Nm ssh-keygen 451e8db6e2SBrian Feldman.Nd authentication key generation, management and conversion 46511b41d2SMark Murray.Sh SYNOPSIS 47511b41d2SMark Murray.Nm ssh-keygen 48d0c8c0bcSDag-Erling Smørgrav.Bk -words 491e8db6e2SBrian Feldman.Op Fl q 50511b41d2SMark Murray.Op Fl b Ar bits 51ae1f160dSDag-Erling Smørgrav.Fl t Ar type 52511b41d2SMark Murray.Op Fl N Ar new_passphrase 53511b41d2SMark Murray.Op Fl C Ar comment 54b66f2d16SKris Kennaway.Op Fl f Ar output_keyfile 55d0c8c0bcSDag-Erling Smørgrav.Ek 56511b41d2SMark Murray.Nm ssh-keygen 57511b41d2SMark Murray.Fl p 58511b41d2SMark Murray.Op Fl P Ar old_passphrase 59511b41d2SMark Murray.Op Fl N Ar new_passphrase 60511b41d2SMark Murray.Op Fl f Ar keyfile 61511b41d2SMark Murray.Nm ssh-keygen 621e8db6e2SBrian Feldman.Fl i 63b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 64a04a10f8SKris Kennaway.Nm ssh-keygen 651e8db6e2SBrian Feldman.Fl e 66b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 67a04a10f8SKris Kennaway.Nm ssh-keygen 68a04a10f8SKris Kennaway.Fl y 69b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 70a04a10f8SKris Kennaway.Nm ssh-keygen 71511b41d2SMark Murray.Fl c 72511b41d2SMark Murray.Op Fl P Ar passphrase 73511b41d2SMark Murray.Op Fl C Ar comment 74511b41d2SMark Murray.Op Fl f Ar keyfile 75511b41d2SMark Murray.Nm ssh-keygen 76511b41d2SMark Murray.Fl l 77b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 78a04a10f8SKris Kennaway.Nm ssh-keygen 791e8db6e2SBrian Feldman.Fl B 801e8db6e2SBrian Feldman.Op Fl f Ar input_keyfile 81ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen 82ae1f160dSDag-Erling Smørgrav.Fl D Ar reader 83ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen 845e8dbd04SDag-Erling Smørgrav.Fl F Ar hostname 855e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 865e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 875e8dbd04SDag-Erling Smørgrav.Fl H 885e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 895e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 905e8dbd04SDag-Erling Smørgrav.Fl R Ar hostname 915e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 925e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 93ae1f160dSDag-Erling Smørgrav.Fl U Ar reader 94ae1f160dSDag-Erling Smørgrav.Op Fl f Ar input_keyfile 95d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen 96d95e11bfSDag-Erling Smørgrav.Fl r Ar hostname 97d95e11bfSDag-Erling Smørgrav.Op Fl f Ar input_keyfile 98d95e11bfSDag-Erling Smørgrav.Op Fl g 99d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen 100d95e11bfSDag-Erling Smørgrav.Fl G Ar output_file 101efcad6b7SDag-Erling Smørgrav.Op Fl v 102d95e11bfSDag-Erling Smørgrav.Op Fl b Ar bits 103d95e11bfSDag-Erling Smørgrav.Op Fl M Ar memory 104d95e11bfSDag-Erling Smørgrav.Op Fl S Ar start_point 105d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen 106d95e11bfSDag-Erling Smørgrav.Fl T Ar output_file 107d95e11bfSDag-Erling Smørgrav.Fl f Ar input_file 108efcad6b7SDag-Erling Smørgrav.Op Fl v 109d95e11bfSDag-Erling Smørgrav.Op Fl a Ar num_trials 110d95e11bfSDag-Erling Smørgrav.Op Fl W Ar generator 111511b41d2SMark Murray.Sh DESCRIPTION 112511b41d2SMark Murray.Nm 1131e8db6e2SBrian Feldmangenerates, manages and converts authentication keys for 114511b41d2SMark Murray.Xr ssh 1 . 115a04a10f8SKris Kennaway.Nm 116ae1f160dSDag-Erling Smørgravcan create RSA keys for use by SSH protocol version 1 and RSA or DSA 117d95e11bfSDag-Erling Smørgravkeys for use by SSH protocol version 2. 118d95e11bfSDag-Erling SmørgravThe type of key to be generated is specified with the 1191e8db6e2SBrian Feldman.Fl t 120ae1f160dSDag-Erling Smørgravoption. 121021d409fSDag-Erling SmørgravIf invoked without any arguments, 122021d409fSDag-Erling Smørgrav.Nm 123021d409fSDag-Erling Smørgravwill generate an RSA key for use in SSH protocol 2 connections. 124a04a10f8SKris Kennaway.Pp 125d95e11bfSDag-Erling Smørgrav.Nm 126d95e11bfSDag-Erling Smørgravis also used to generate groups for use in Diffie-Hellman group 127d95e11bfSDag-Erling Smørgravexchange (DH-GEX). 128d95e11bfSDag-Erling SmørgravSee the 129d95e11bfSDag-Erling Smørgrav.Sx MODULI GENERATION 130d95e11bfSDag-Erling Smørgravsection for details. 131d95e11bfSDag-Erling Smørgrav.Pp 132511b41d2SMark MurrayNormally each user wishing to use SSH 133a04a10f8SKris Kennawaywith RSA or DSA authentication runs this once to create the authentication 134511b41d2SMark Murraykey in 135043840dfSDag-Erling Smørgrav.Pa ~/.ssh/identity , 136043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_dsa 137a04a10f8SKris Kennawayor 138043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa . 139a04a10f8SKris KennawayAdditionally, the system administrator may use this to generate host keys, 140a04a10f8SKris Kennawayas seen in 141a04a10f8SKris Kennaway.Pa /etc/rc . 142511b41d2SMark Murray.Pp 143511b41d2SMark MurrayNormally this program generates the key and asks for a file in which 144a8f6863aSKris Kennawayto store the private key. 145a8f6863aSKris KennawayThe public key is stored in a file with the same name but 146511b41d2SMark Murray.Dq .pub 147a8f6863aSKris Kennawayappended. 148a8f6863aSKris KennawayThe program also asks for a passphrase. 149a8f6863aSKris KennawayThe passphrase may be empty to indicate no passphrase 1501e8db6e2SBrian Feldman(host keys must have an empty passphrase), or it may be a string of 151a8f6863aSKris Kennawayarbitrary length. 152ae1f160dSDag-Erling SmørgravA passphrase is similar to a password, except it can be a phrase with a 153ae1f160dSDag-Erling Smørgravseries of words, punctuation, numbers, whitespace, or any string of 154ae1f160dSDag-Erling Smørgravcharacters you want. 155ae1f160dSDag-Erling SmørgravGood passphrases are 10-30 characters long, are 156511b41d2SMark Murraynot simple sentences or otherwise easily guessable (English 157ae1f160dSDag-Erling Smørgravprose has only 1-2 bits of entropy per character, and provides very bad 158ae1f160dSDag-Erling Smørgravpassphrases), and contain a mix of upper and lowercase letters, 159ae1f160dSDag-Erling Smørgravnumbers, and non-alphanumeric characters. 160a8f6863aSKris KennawayThe passphrase can be changed later by using the 161511b41d2SMark Murray.Fl p 162511b41d2SMark Murrayoption. 163511b41d2SMark Murray.Pp 164a8f6863aSKris KennawayThere is no way to recover a lost passphrase. 165a8f6863aSKris KennawayIf the passphrase is 166ae1f160dSDag-Erling Smørgravlost or forgotten, a new key must be generated and copied to the 167511b41d2SMark Murraycorresponding public key to other machines. 168511b41d2SMark Murray.Pp 1691e8db6e2SBrian FeldmanFor RSA1 keys, 1701e8db6e2SBrian Feldmanthere is also a comment field in the key file that is only for 171a8f6863aSKris Kennawayconvenience to the user to help identify the key. 172a8f6863aSKris KennawayThe comment can tell what the key is for, or whatever is useful. 173a8f6863aSKris KennawayThe comment is initialized to 174511b41d2SMark Murray.Dq user@host 175511b41d2SMark Murraywhen the key is created, but can be changed using the 176511b41d2SMark Murray.Fl c 177511b41d2SMark Murrayoption. 178511b41d2SMark Murray.Pp 179a04a10f8SKris KennawayAfter a key is generated, instructions below detail where the keys 180a04a10f8SKris Kennawayshould be placed to be activated. 181a04a10f8SKris Kennaway.Pp 182511b41d2SMark MurrayThe options are as follows: 183511b41d2SMark Murray.Bl -tag -width Ds 184d95e11bfSDag-Erling Smørgrav.It Fl a Ar trials 185d95e11bfSDag-Erling SmørgravSpecifies the number of primality tests to perform when screening DH-GEX 186d95e11bfSDag-Erling Smørgravcandidates using the 187d95e11bfSDag-Erling Smørgrav.Fl T 188d95e11bfSDag-Erling Smørgravcommand. 1895e8dbd04SDag-Erling Smørgrav.It Fl B 1905e8dbd04SDag-Erling SmørgravShow the bubblebabble digest of specified private or public key file. 191511b41d2SMark Murray.It Fl b Ar bits 192a8f6863aSKris KennawaySpecifies the number of bits in the key to create. 193021d409fSDag-Erling SmørgravFor RSA keys, the minimum size is 768 bits and the default is 2048 bits. 194043840dfSDag-Erling SmørgravGenerally, 2048 bits is considered sufficient. 195021d409fSDag-Erling SmørgravDSA keys must be exactly 1024 bits as specified by FIPS 186-2. 1965e8dbd04SDag-Erling Smørgrav.It Fl C Ar comment 1975e8dbd04SDag-Erling SmørgravProvides a new comment. 198511b41d2SMark Murray.It Fl c 199511b41d2SMark MurrayRequests changing the comment in the private and public key files. 200ae1f160dSDag-Erling SmørgravThis operation is only supported for RSA1 keys. 201511b41d2SMark MurrayThe program will prompt for the file containing the private keys, for 202ae1f160dSDag-Erling Smørgravthe passphrase if the key has one, and for the new comment. 2035e8dbd04SDag-Erling Smørgrav.It Fl D Ar reader 2045e8dbd04SDag-Erling SmørgravDownload the RSA public key stored in the smartcard in 2055e8dbd04SDag-Erling Smørgrav.Ar reader . 2061e8db6e2SBrian Feldman.It Fl e 2071e8db6e2SBrian FeldmanThis option will read a private or public OpenSSH key file and 208d4af9e69SDag-Erling Smørgravprint the key in 209d4af9e69SDag-Erling SmørgravRFC 4716 SSH Public Key File Format 2101e8db6e2SBrian Feldmanto stdout. 2111e8db6e2SBrian FeldmanThis option allows exporting keys for use by several commercial 2121e8db6e2SBrian FeldmanSSH implementations. 2135e8dbd04SDag-Erling Smørgrav.It Fl F Ar hostname 2145e8dbd04SDag-Erling SmørgravSearch for the specified 2155e8dbd04SDag-Erling Smørgrav.Ar hostname 2165e8dbd04SDag-Erling Smørgravin a 2175e8dbd04SDag-Erling Smørgrav.Pa known_hosts 2185e8dbd04SDag-Erling Smørgravfile, listing any occurrences found. 2195e8dbd04SDag-Erling SmørgravThis option is useful to find hashed host names or addresses and may also be 2205e8dbd04SDag-Erling Smørgravused in conjunction with the 2215e8dbd04SDag-Erling Smørgrav.Fl H 2225e8dbd04SDag-Erling Smørgravoption to print found keys in a hashed format. 2235e8dbd04SDag-Erling Smørgrav.It Fl f Ar filename 2245e8dbd04SDag-Erling SmørgravSpecifies the filename of the key file. 2255e8dbd04SDag-Erling Smørgrav.It Fl G Ar output_file 2265e8dbd04SDag-Erling SmørgravGenerate candidate primes for DH-GEX. 2275e8dbd04SDag-Erling SmørgravThese primes must be screened for 2285e8dbd04SDag-Erling Smørgravsafety (using the 2295e8dbd04SDag-Erling Smørgrav.Fl T 2305e8dbd04SDag-Erling Smørgravoption) before use. 231d95e11bfSDag-Erling Smørgrav.It Fl g 232d74d50a8SDag-Erling SmørgravUse generic DNS format when printing fingerprint resource records using the 233d74d50a8SDag-Erling Smørgrav.Fl r 234d74d50a8SDag-Erling Smørgravcommand. 2355e8dbd04SDag-Erling Smørgrav.It Fl H 2365e8dbd04SDag-Erling SmørgravHash a 2375e8dbd04SDag-Erling Smørgrav.Pa known_hosts 2384518870cSDag-Erling Smørgravfile. 2394518870cSDag-Erling SmørgravThis replaces all hostnames and addresses with hashed representations 2404518870cSDag-Erling Smørgravwithin the specified file; the original content is moved to a file with 2414518870cSDag-Erling Smørgrava .old suffix. 2425e8dbd04SDag-Erling SmørgravThese hashes may be used normally by 2435e8dbd04SDag-Erling Smørgrav.Nm ssh 2445e8dbd04SDag-Erling Smørgravand 2455e8dbd04SDag-Erling Smørgrav.Nm sshd , 2465e8dbd04SDag-Erling Smørgravbut they do not reveal identifying information should the file's contents 2475e8dbd04SDag-Erling Smørgravbe disclosed. 2485e8dbd04SDag-Erling SmørgravThis option will not modify existing hashed hostnames and is therefore safe 2495e8dbd04SDag-Erling Smørgravto use on files that mix hashed and non-hashed names. 2501e8db6e2SBrian Feldman.It Fl i 2511e8db6e2SBrian FeldmanThis option will read an unencrypted private (or public) key file 2521e8db6e2SBrian Feldmanin SSH2-compatible format and print an OpenSSH compatible private 2531e8db6e2SBrian Feldman(or public) key to stdout. 2541e8db6e2SBrian Feldman.Nm 2551e8db6e2SBrian Feldmanalso reads the 256d4af9e69SDag-Erling SmørgravRFC 4716 SSH Public Key File Format. 2571e8db6e2SBrian FeldmanThis option allows importing keys from several commercial 2581e8db6e2SBrian FeldmanSSH implementations. 259511b41d2SMark Murray.It Fl l 260ae1f160dSDag-Erling SmørgravShow fingerprint of specified public key file. 261ae1f160dSDag-Erling SmørgravPrivate RSA1 keys are also supported. 262ae1f160dSDag-Erling SmørgravFor RSA and DSA keys 263ae1f160dSDag-Erling Smørgrav.Nm 264ae1f160dSDag-Erling Smørgravtries to find the matching public key file and prints its fingerprint. 265d4af9e69SDag-Erling SmørgravIf combined with 266d4af9e69SDag-Erling Smørgrav.Fl v , 267d4af9e69SDag-Erling Smørgravan ASCII art representation of the key is supplied with the fingerprint. 2685e8dbd04SDag-Erling Smørgrav.It Fl M Ar memory 2695e8dbd04SDag-Erling SmørgravSpecify the amount of memory to use (in megabytes) when generating 2705e8dbd04SDag-Erling Smørgravcandidate moduli for DH-GEX. 2715e8dbd04SDag-Erling Smørgrav.It Fl N Ar new_passphrase 2725e8dbd04SDag-Erling SmørgravProvides the new passphrase. 2735e8dbd04SDag-Erling Smørgrav.It Fl P Ar passphrase 2745e8dbd04SDag-Erling SmørgravProvides the (old) passphrase. 275511b41d2SMark Murray.It Fl p 276511b41d2SMark MurrayRequests changing the passphrase of a private key file instead of 277a8f6863aSKris Kennawaycreating a new private key. 278a8f6863aSKris KennawayThe program will prompt for the file 279511b41d2SMark Murraycontaining the private key, for the old passphrase, and twice for the 280511b41d2SMark Murraynew passphrase. 281511b41d2SMark Murray.It Fl q 282511b41d2SMark MurraySilence 283511b41d2SMark Murray.Nm ssh-keygen . 284511b41d2SMark MurrayUsed by 285511b41d2SMark Murray.Pa /etc/rc 286511b41d2SMark Murraywhen creating a new key. 2875e8dbd04SDag-Erling Smørgrav.It Fl R Ar hostname 2885e8dbd04SDag-Erling SmørgravRemoves all keys belonging to 2895e8dbd04SDag-Erling Smørgrav.Ar hostname 2905e8dbd04SDag-Erling Smørgravfrom a 2915e8dbd04SDag-Erling Smørgrav.Pa known_hosts 2925e8dbd04SDag-Erling Smørgravfile. 2935e8dbd04SDag-Erling SmørgravThis option is useful to delete hashed hosts (see the 2945e8dbd04SDag-Erling Smørgrav.Fl H 2955e8dbd04SDag-Erling Smørgravoption above). 2965e8dbd04SDag-Erling Smørgrav.It Fl r Ar hostname 2975e8dbd04SDag-Erling SmørgravPrint the SSHFP fingerprint resource record named 2985e8dbd04SDag-Erling Smørgrav.Ar hostname 2995e8dbd04SDag-Erling Smørgravfor the specified public key file. 3005e8dbd04SDag-Erling Smørgrav.It Fl S Ar start 3015e8dbd04SDag-Erling SmørgravSpecify start point (in hex) when generating candidate moduli for DH-GEX. 3025e8dbd04SDag-Erling Smørgrav.It Fl T Ar output_file 3035e8dbd04SDag-Erling SmørgravTest DH group exchange candidate primes (generated using the 3045e8dbd04SDag-Erling Smørgrav.Fl G 3055e8dbd04SDag-Erling Smørgravoption) for safety. 3061e8db6e2SBrian Feldman.It Fl t Ar type 3075e8dbd04SDag-Erling SmørgravSpecifies the type of key to create. 3081e8db6e2SBrian FeldmanThe possible values are 3091e8db6e2SBrian Feldman.Dq rsa1 3101e8db6e2SBrian Feldmanfor protocol version 1 and 3111e8db6e2SBrian Feldman.Dq rsa 3121e8db6e2SBrian Feldmanor 3131e8db6e2SBrian Feldman.Dq dsa 3141e8db6e2SBrian Feldmanfor protocol version 2. 315ae1f160dSDag-Erling Smørgrav.It Fl U Ar reader 316ae1f160dSDag-Erling SmørgravUpload an existing RSA private key into the smartcard in 317ae1f160dSDag-Erling Smørgrav.Ar reader . 318efcad6b7SDag-Erling Smørgrav.It Fl v 319efcad6b7SDag-Erling SmørgravVerbose mode. 320efcad6b7SDag-Erling SmørgravCauses 321efcad6b7SDag-Erling Smørgrav.Nm 322efcad6b7SDag-Erling Smørgravto print debugging messages about its progress. 323efcad6b7SDag-Erling SmørgravThis is helpful for debugging moduli generation. 324efcad6b7SDag-Erling SmørgravMultiple 325efcad6b7SDag-Erling Smørgrav.Fl v 326efcad6b7SDag-Erling Smørgravoptions increase the verbosity. 327efcad6b7SDag-Erling SmørgravThe maximum is 3. 3285e8dbd04SDag-Erling Smørgrav.It Fl W Ar generator 3295e8dbd04SDag-Erling SmørgravSpecify desired generator when testing candidate moduli for DH-GEX. 3305e8dbd04SDag-Erling Smørgrav.It Fl y 3315e8dbd04SDag-Erling SmørgravThis option will read a private 3325e8dbd04SDag-Erling SmørgravOpenSSH format file and print an OpenSSH public key to stdout. 333511b41d2SMark Murray.El 334d95e11bfSDag-Erling Smørgrav.Sh MODULI GENERATION 335d95e11bfSDag-Erling Smørgrav.Nm 336d95e11bfSDag-Erling Smørgravmay be used to generate groups for the Diffie-Hellman Group Exchange 337d95e11bfSDag-Erling Smørgrav(DH-GEX) protocol. 338d95e11bfSDag-Erling SmørgravGenerating these groups is a two-step process: first, candidate 339d95e11bfSDag-Erling Smørgravprimes are generated using a fast, but memory intensive process. 340d95e11bfSDag-Erling SmørgravThese candidate primes are then tested for suitability (a CPU-intensive 341d95e11bfSDag-Erling Smørgravprocess). 342d95e11bfSDag-Erling Smørgrav.Pp 343d95e11bfSDag-Erling SmørgravGeneration of primes is performed using the 344d95e11bfSDag-Erling Smørgrav.Fl G 345d95e11bfSDag-Erling Smørgravoption. 346d95e11bfSDag-Erling SmørgravThe desired length of the primes may be specified by the 347d95e11bfSDag-Erling Smørgrav.Fl b 348d95e11bfSDag-Erling Smørgravoption. 349d95e11bfSDag-Erling SmørgravFor example: 350d95e11bfSDag-Erling Smørgrav.Pp 3515e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -G moduli-2048.candidates -b 2048 352d95e11bfSDag-Erling Smørgrav.Pp 353d95e11bfSDag-Erling SmørgravBy default, the search for primes begins at a random point in the 354d95e11bfSDag-Erling Smørgravdesired length range. 355d95e11bfSDag-Erling SmørgravThis may be overridden using the 356d95e11bfSDag-Erling Smørgrav.Fl S 357d95e11bfSDag-Erling Smørgravoption, which specifies a different start point (in hex). 358d95e11bfSDag-Erling Smørgrav.Pp 359d95e11bfSDag-Erling SmørgravOnce a set of candidates have been generated, they must be tested for 360d95e11bfSDag-Erling Smørgravsuitability. 361d95e11bfSDag-Erling SmørgravThis may be performed using the 362d95e11bfSDag-Erling Smørgrav.Fl T 363d95e11bfSDag-Erling Smørgravoption. 364d95e11bfSDag-Erling SmørgravIn this mode 365d95e11bfSDag-Erling Smørgrav.Nm 366d95e11bfSDag-Erling Smørgravwill read candidates from standard input (or a file specified using the 367d95e11bfSDag-Erling Smørgrav.Fl f 368d95e11bfSDag-Erling Smørgravoption). 369d95e11bfSDag-Erling SmørgravFor example: 370d95e11bfSDag-Erling Smørgrav.Pp 3715e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates 372d95e11bfSDag-Erling Smørgrav.Pp 373d95e11bfSDag-Erling SmørgravBy default, each candidate will be subjected to 100 primality tests. 374d95e11bfSDag-Erling SmørgravThis may be overridden using the 375d95e11bfSDag-Erling Smørgrav.Fl a 376d95e11bfSDag-Erling Smørgravoption. 377d95e11bfSDag-Erling SmørgravThe DH generator value will be chosen automatically for the 378d95e11bfSDag-Erling Smørgravprime under consideration. 379d95e11bfSDag-Erling SmørgravIf a specific generator is desired, it may be requested using the 380d95e11bfSDag-Erling Smørgrav.Fl W 381d95e11bfSDag-Erling Smørgravoption. 3825e8dbd04SDag-Erling SmørgravValid generator values are 2, 3, and 5. 383d95e11bfSDag-Erling Smørgrav.Pp 384d95e11bfSDag-Erling SmørgravScreened DH groups may be installed in 385d95e11bfSDag-Erling Smørgrav.Pa /etc/moduli . 386d95e11bfSDag-Erling SmørgravIt is important that this file contains moduli of a range of bit lengths and 387d95e11bfSDag-Erling Smørgravthat both ends of a connection share common moduli. 388511b41d2SMark Murray.Sh FILES 389511b41d2SMark Murray.Bl -tag -width Ds 390043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/identity 3911e8db6e2SBrian FeldmanContains the protocol version 1 RSA authentication identity of the user. 392a8f6863aSKris KennawayThis file should not be readable by anyone but the user. 393a8f6863aSKris KennawayIt is possible to 394511b41d2SMark Murrayspecify a passphrase when generating the key; that passphrase will be 395a8f6863aSKris Kennawayused to encrypt the private part of this file using 3DES. 396a8f6863aSKris KennawayThis file is not automatically accessed by 397511b41d2SMark Murray.Nm 398511b41d2SMark Murraybut it is offered as the default file for the private key. 399ae1f160dSDag-Erling Smørgrav.Xr ssh 1 400a04a10f8SKris Kennawaywill read this file when a login attempt is made. 401043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/identity.pub 4021e8db6e2SBrian FeldmanContains the protocol version 1 RSA public key for authentication. 403a8f6863aSKris KennawayThe contents of this file should be added to 404043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 405511b41d2SMark Murrayon all machines 406ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using RSA authentication. 407a8f6863aSKris KennawayThere is no need to keep the contents of this file secret. 408043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa 4091e8db6e2SBrian FeldmanContains the protocol version 2 DSA authentication identity of the user. 410a04a10f8SKris KennawayThis file should not be readable by anyone but the user. 411a04a10f8SKris KennawayIt is possible to 412a04a10f8SKris Kennawayspecify a passphrase when generating the key; that passphrase will be 413a04a10f8SKris Kennawayused to encrypt the private part of this file using 3DES. 414a04a10f8SKris KennawayThis file is not automatically accessed by 415a04a10f8SKris Kennaway.Nm 416a04a10f8SKris Kennawaybut it is offered as the default file for the private key. 417ae1f160dSDag-Erling Smørgrav.Xr ssh 1 418a04a10f8SKris Kennawaywill read this file when a login attempt is made. 419043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa.pub 4201e8db6e2SBrian FeldmanContains the protocol version 2 DSA public key for authentication. 421a04a10f8SKris KennawayThe contents of this file should be added to 422043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 423a04a10f8SKris Kennawayon all machines 424ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication. 4251e8db6e2SBrian FeldmanThere is no need to keep the contents of this file secret. 426043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa 4271e8db6e2SBrian FeldmanContains the protocol version 2 RSA authentication identity of the user. 4281e8db6e2SBrian FeldmanThis file should not be readable by anyone but the user. 4291e8db6e2SBrian FeldmanIt is possible to 4301e8db6e2SBrian Feldmanspecify a passphrase when generating the key; that passphrase will be 4311e8db6e2SBrian Feldmanused to encrypt the private part of this file using 3DES. 4321e8db6e2SBrian FeldmanThis file is not automatically accessed by 4331e8db6e2SBrian Feldman.Nm 4341e8db6e2SBrian Feldmanbut it is offered as the default file for the private key. 435ae1f160dSDag-Erling Smørgrav.Xr ssh 1 4361e8db6e2SBrian Feldmanwill read this file when a login attempt is made. 437043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa.pub 4381e8db6e2SBrian FeldmanContains the protocol version 2 RSA public key for authentication. 4391e8db6e2SBrian FeldmanThe contents of this file should be added to 440043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 4411e8db6e2SBrian Feldmanon all machines 442ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication. 443a04a10f8SKris KennawayThere is no need to keep the contents of this file secret. 444d95e11bfSDag-Erling Smørgrav.It Pa /etc/moduli 445d95e11bfSDag-Erling SmørgravContains Diffie-Hellman groups used for DH-GEX. 446d95e11bfSDag-Erling SmørgravThe file format is described in 447d95e11bfSDag-Erling Smørgrav.Xr moduli 5 . 448b66f2d16SKris Kennaway.El 449511b41d2SMark Murray.Sh SEE ALSO 450511b41d2SMark Murray.Xr ssh 1 , 451511b41d2SMark Murray.Xr ssh-add 1 , 452511b41d2SMark Murray.Xr ssh-agent 1 , 453d95e11bfSDag-Erling Smørgrav.Xr moduli 5 , 4541e8db6e2SBrian Feldman.Xr sshd 8 4551e8db6e2SBrian Feldman.Rs 456d4af9e69SDag-Erling Smørgrav.%R RFC 4716 457d4af9e69SDag-Erling Smørgrav.%T "The Secure Shell (SSH) Public Key File Format" 458d4af9e69SDag-Erling Smørgrav.%D 2006 4591e8db6e2SBrian Feldman.Re 460d95e11bfSDag-Erling Smørgrav.Sh AUTHORS 461d95e11bfSDag-Erling SmørgravOpenSSH is a derivative of the original and free 462d95e11bfSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen. 463d95e11bfSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 464d95e11bfSDag-Erling SmørgravTheo de Raadt and Dug Song 465d95e11bfSDag-Erling Smørgravremoved many bugs, re-added newer features and 466d95e11bfSDag-Erling Smørgravcreated OpenSSH. 467d95e11bfSDag-Erling SmørgravMarkus Friedl contributed the support for SSH 468d95e11bfSDag-Erling Smørgravprotocol versions 1.5 and 2.0. 469