1.\" $NetBSD: ssh-keygen.1,v 1.16 2016/03/11 01:55:00 christos Exp $ 2.\" $OpenBSD: ssh-keygen.1,v 1.130 2016/02/17 07:38:19 jmc Exp $ 3.\" 4.\" -*- nroff -*- 5.\" 6.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 7.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8.\" All rights reserved 9.\" 10.\" As far as I am concerned, the code I have written for this software 11.\" can be used freely for any purpose. Any derived versions of this 12.\" software must be clearly marked as such, and if the derived work is 13.\" incompatible with the protocol description in the RFC file, it must be 14.\" called by a name other than "ssh" or "Secure Shell". 15.\" 16.\" 17.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 18.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 19.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 20.\" 21.\" Redistribution and use in source and binary forms, with or without 22.\" modification, are permitted provided that the following conditions 23.\" are met: 24.\" 1. Redistributions of source code must retain the above copyright 25.\" notice, this list of conditions and the following disclaimer. 26.\" 2. Redistributions in binary form must reproduce the above copyright 27.\" notice, this list of conditions and the following disclaimer in the 28.\" documentation and/or other materials provided with the distribution. 29.\" 30.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 31.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 32.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 33.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 34.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40.\" 41.Dd February 17 2016 42.Dt SSH-KEYGEN 1 43.Os 44.Sh NAME 45.Nm ssh-keygen 46.Nd authentication key generation, management and conversion 47.Sh SYNOPSIS 48.Bk -words 49.Nm ssh-keygen 50.Op Fl q 51.Op Fl b Ar bits 52.Op Fl t Cm dsa | ecdsa | ed25519 | rsa | rsa1 53.Op Fl N Ar new_passphrase 54.Op Fl C Ar comment 55.Op Fl f Ar output_keyfile 56.Nm ssh-keygen 57.Fl p 58.Op Fl P Ar old_passphrase 59.Op Fl N Ar new_passphrase 60.Op Fl f Ar keyfile 61.Nm ssh-keygen 62.Fl i 63.Op Fl m Ar key_format 64.Op Fl f Ar input_keyfile 65.Nm ssh-keygen 66.Fl e 67.Op Fl m Ar key_format 68.Op Fl f Ar input_keyfile 69.Nm ssh-keygen 70.Fl y 71.Op Fl f Ar input_keyfile 72.Nm ssh-keygen 73.Fl c 74.Op Fl P Ar passphrase 75.Op Fl C Ar comment 76.Op Fl f Ar keyfile 77.Nm ssh-keygen 78.Fl l 79.Op Fl v 80.Op Fl E Ar fingerprint_hash 81.Op Fl f Ar input_keyfile 82.Nm ssh-keygen 83.Fl B 84.Op Fl f Ar input_keyfile 85.Nm ssh-keygen 86.Fl D Ar pkcs11 87.Nm ssh-keygen 88.Fl F Ar hostname 89.Op Fl f Ar known_hosts_file 90.Op Fl l 91.Nm ssh-keygen 92.Fl H 93.Op Fl f Ar known_hosts_file 94.Nm ssh-keygen 95.Fl R Ar hostname 96.Op Fl f Ar known_hosts_file 97.Nm ssh-keygen 98.Fl r Ar hostname 99.Op Fl f Ar input_keyfile 100.Op Fl g 101.Nm ssh-keygen 102.Fl G Ar output_file 103.Op Fl v 104.Op Fl b Ar bits 105.Op Fl M Ar memory 106.Op Fl S Ar start_point 107.Nm ssh-keygen 108.Fl T Ar output_file 109.Fl f Ar input_file 110.Op Fl v 111.Op Fl a Ar rounds 112.Op Fl J Ar num_lines 113.Op Fl j Ar start_line 114.Op Fl K Ar checkpt 115.Op Fl W Ar generator 116.Nm ssh-keygen 117.Fl s Ar ca_key 118.Fl I Ar certificate_identity 119.Op Fl h 120.Op Fl n Ar principals 121.Op Fl O Ar option 122.Op Fl V Ar validity_interval 123.Op Fl z Ar serial_number 124.Ar 125.Nm ssh-keygen 126.Fl L 127.Op Fl f Ar input_keyfile 128.Nm ssh-keygen 129.Fl A 130.Nm ssh-keygen 131.Fl k 132.Fl f Ar krl_file 133.Op Fl u 134.Op Fl s Ar ca_public 135.Op Fl z Ar version_number 136.Ar 137.Nm ssh-keygen 138.Fl Q 139.Fl f Ar krl_file 140.Ar 141.Ek 142.Sh DESCRIPTION 143.Nm 144generates, manages and converts authentication keys for 145.Xr ssh 1 . 146.Nm 147can create keys for use by SSH protocol versions 1 and 2. 148Protocol 1 should not be used 149and is only offered to support legacy devices. 150It suffers from a number of cryptographic weaknesses 151and doesn't support many of the advanced features available for protocol 2. 152.Pp 153The type of key to be generated is specified with the 154.Fl t 155option. 156If invoked without any arguments, 157.Nm 158will generate an RSA key for use in SSH protocol 2 connections. 159.Pp 160.Nm 161is also used to generate groups for use in Diffie-Hellman group 162exchange (DH-GEX). 163See the 164.Sx MODULI GENERATION 165section for details. 166.Pp 167Finally, 168.Nm 169can be used to generate and update Key Revocation Lists, and to test whether 170given keys have been revoked by one. 171See the 172.Sx KEY REVOCATION LISTS 173section for details. 174.Pp 175Normally each user wishing to use SSH 176with public key authentication runs this once to create the authentication 177key in 178.Pa ~/.ssh/identity , 179.Pa ~/.ssh/id_dsa , 180.Pa ~/.ssh/id_ecdsa , 181.Pa ~/.ssh/id_ed25519 182or 183.Pa ~/.ssh/id_rsa . 184Additionally, the system administrator may use this to generate host keys, 185as seen in 186.Pa /etc/rc.d/sshd . 187.Pp 188Normally this program generates the key and asks for a file in which 189to store the private key. 190The public key is stored in a file with the same name but 191.Dq .pub 192appended. 193The program also asks for a passphrase. 194The passphrase may be empty to indicate no passphrase 195(host keys must have an empty passphrase), or it may be a string of 196arbitrary length. 197A passphrase is similar to a password, except it can be a phrase with a 198series of words, punctuation, numbers, whitespace, or any string of 199characters you want. 200Good passphrases are 10-30 characters long, are 201not simple sentences or otherwise easily guessable (English 202prose has only 1-2 bits of entropy per character, and provides very bad 203passphrases), and contain a mix of upper and lowercase letters, 204numbers, and non-alphanumeric characters. 205The passphrase can be changed later by using the 206.Fl p 207option. 208.Pp 209There is no way to recover a lost passphrase. 210If the passphrase is lost or forgotten, a new key must be generated 211and the corresponding public key copied to other machines. 212.Pp 213For RSA1 keys, 214there is also a comment field in the key file that is only for 215convenience to the user to help identify the key. 216The comment can tell what the key is for, or whatever is useful. 217The comment is initialized to 218.Dq user@host 219when the key is created, but can be changed using the 220.Fl c 221option. 222.Pp 223After a key is generated, instructions below detail where the keys 224should be placed to be activated. 225.Pp 226The options are as follows: 227.Bl -tag -width Ds 228.It Fl A 229For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) 230for which host keys 231do not exist, generate the host keys with the default key file path, 232an empty passphrase, default bits for the key type, and default comment. 233This is used by 234.Pa /etc/rc 235to generate new host keys. 236.It Fl a Ar rounds 237When saving a new-format private key (i.e. an ed25519 key or any SSH protocol 2382 key when the 239.Fl o 240flag is set), this option specifies the number of KDF (key derivation function) 241rounds used. 242Higher numbers result in slower passphrase verification and increased 243resistance to brute-force password cracking (should the keys be stolen). 244.Pp 245When screening DH-GEX candidates ( 246using the 247.Fl T 248command). 249This option specifies the number of primality tests to perform. 250.It Fl B 251Show the bubblebabble digest of specified private or public key file. 252.It Fl b Ar bits 253Specifies the number of bits in the key to create. 254For RSA keys, the minimum size is 1024 bits and the default is 2048 bits. 255Generally, 2048 bits is considered sufficient. 256DSA keys must be exactly 1024 bits as specified by FIPS 186-2. 257For ECDSA keys, the 258.Fl b 259flag determines the key length by selecting from one of three elliptic 260curve sizes: 256, 384 or 521 bits. 261Attempting to use bit lengths other than these three values for ECDSA keys 262will fail. 263Ed25519 keys have a fixed length and the 264.Fl b 265flag will be ignored. 266.It Fl C Ar comment 267Provides a new comment. 268.It Fl c 269Requests changing the comment in the private and public key files. 270This operation is only supported for RSA1 keys. 271The program will prompt for the file containing the private keys, for 272the passphrase if the key has one, and for the new comment. 273.It Fl D Ar pkcs11 274Download the RSA public keys provided by the PKCS#11 shared library 275.Ar pkcs11 . 276When used in combination with 277.Fl s , 278this option indicates that a CA key resides in a PKCS#11 token (see the 279.Sx CERTIFICATES 280section for details). 281.It Fl E Ar fingerprint_hash 282Specifies the hash algorithm used when displaying key fingerprints. 283Valid options are: 284.Dq md5 285and 286.Dq sha256 . 287The default is 288.Dq sha256 . 289.It Fl e 290This option will read a private or public OpenSSH key file and 291print to stdout the key in one of the formats specified by the 292.Fl m 293option. 294The default export format is 295.Dq RFC4716 . 296This option allows exporting OpenSSH keys for use by other programs, including 297several commercial SSH implementations. 298.It Fl F Ar hostname 299Search for the specified 300.Ar hostname 301in a 302.Pa known_hosts 303file, listing any occurrences found. 304This option is useful to find hashed host names or addresses and may also be 305used in conjunction with the 306.Fl H 307option to print found keys in a hashed format. 308.It Fl f Ar filename 309Specifies the filename of the key file. 310.It Fl G Ar output_file 311Generate candidate primes for DH-GEX. 312These primes must be screened for 313safety (using the 314.Fl T 315option) before use. 316.It Fl g 317Use generic DNS format when printing fingerprint resource records using the 318.Fl r 319command. 320.It Fl H 321Hash a 322.Pa known_hosts 323file. 324This replaces all hostnames and addresses with hashed representations 325within the specified file; the original content is moved to a file with 326a .old suffix. 327These hashes may be used normally by 328.Nm ssh 329and 330.Nm sshd , 331but they do not reveal identifying information should the file's contents 332be disclosed. 333This option will not modify existing hashed hostnames and is therefore safe 334to use on files that mix hashed and non-hashed names. 335.It Fl h 336When signing a key, create a host certificate instead of a user 337certificate. 338Please see the 339.Sx CERTIFICATES 340section for details. 341.It Fl I Ar certificate_identity 342Specify the key identity when signing a public key. 343Please see the 344.Sx CERTIFICATES 345section for details. 346.It Fl i 347This option will read an unencrypted private (or public) key file 348in the format specified by the 349.Fl m 350option and print an OpenSSH compatible private 351(or public) key to stdout. 352This option allows importing keys from other software, including several 353commercial SSH implementations. 354The default import format is 355.Dq RFC4716 . 356.It Fl J Ar num_lines 357Exit after screening the specified number of lines 358while performing DH candidate screening using the 359.Fl T 360option. 361.It Fl j Ar start_line 362Start screening at the specified line number 363while performing DH candidate screening using the 364.Fl T 365option. 366.It Fl K Ar checkpt 367Write the last line processed to the file 368.Ar checkpt 369while performing DH candidate screening using the 370.Fl T 371option. 372This will be used to skip lines in the input file that have already been 373processed if the job is restarted. 374.It Fl k 375Generate a KRL file. 376In this mode, 377.Nm 378will generate a KRL file at the location specified via the 379.Fl f 380flag that revokes every key or certificate presented on the command line. 381Keys/certificates to be revoked may be specified by public key file or 382using the format described in the 383.Sx KEY REVOCATION LISTS 384section. 385.It Fl L 386Prints the contents of one or more certificates. 387.It Fl l 388Show fingerprint of specified public key file. 389Private RSA1 keys are also supported. 390For RSA and DSA keys 391.Nm 392tries to find the matching public key file and prints its fingerprint. 393If combined with 394.Fl v , 395an ASCII art representation of the key is supplied with the fingerprint. 396.It Fl M Ar memory 397Specify the amount of memory to use (in megabytes) when generating 398candidate moduli for DH-GEX. 399.It Fl m Ar key_format 400Specify a key format for the 401.Fl i 402(import) or 403.Fl e 404(export) conversion options. 405The supported key formats are: 406.Dq RFC4716 407(RFC 4716/SSH2 public or private key), 408.Dq PKCS8 409(PEM PKCS8 public key) 410or 411.Dq PEM 412(PEM public key). 413The default conversion format is 414.Dq RFC4716 . 415.It Fl N Ar new_passphrase 416Provides the new passphrase. 417.It Fl n Ar principals 418Specify one or more principals (user or host names) to be included in 419a certificate when signing a key. 420Multiple principals may be specified, separated by commas. 421Please see the 422.Sx CERTIFICATES 423section for details. 424.It Fl O Ar option 425Specify a certificate option when signing a key. 426This option may be specified multiple times. 427Please see the 428.Sx CERTIFICATES 429section for details. 430The options that are valid for user certificates are: 431.Bl -tag -width Ds 432.It Ic clear 433Clear all enabled permissions. 434This is useful for clearing the default set of permissions so permissions may 435be added individually. 436.It Ic force-command Ns = Ns Ar command 437Forces the execution of 438.Ar command 439instead of any shell or command specified by the user when 440the certificate is used for authentication. 441.It Ic no-agent-forwarding 442Disable 443.Xr ssh-agent 1 444forwarding (permitted by default). 445.It Ic no-port-forwarding 446Disable port forwarding (permitted by default). 447.It Ic no-pty 448Disable PTY allocation (permitted by default). 449.It Ic no-user-rc 450Disable execution of 451.Pa ~/.ssh/rc 452by 453.Xr sshd 8 454(permitted by default). 455.It Ic no-x11-forwarding 456Disable X11 forwarding (permitted by default). 457.It Ic permit-agent-forwarding 458Allows 459.Xr ssh-agent 1 460forwarding. 461.It Ic permit-port-forwarding 462Allows port forwarding. 463.It Ic permit-pty 464Allows PTY allocation. 465.It Ic permit-user-rc 466Allows execution of 467.Pa ~/.ssh/rc 468by 469.Xr sshd 8 . 470.It Ic permit-x11-forwarding 471Allows X11 forwarding. 472.It Ic source-address Ns = Ns Ar address_list 473Restrict the source addresses from which the certificate is considered valid. 474The 475.Ar address_list 476is a comma-separated list of one or more address/netmask pairs in CIDR 477format. 478.El 479.Pp 480At present, no options are valid for host keys. 481.It Fl o 482Causes 483.Nm 484to save private keys using the new OpenSSH format rather than 485the more compatible PEM format. 486The new format has increased resistance to brute-force password cracking 487but is not supported by versions of OpenSSH prior to 6.5. 488Ed25519 keys always use the new private key format. 489.It Fl P Ar passphrase 490Provides the (old) passphrase. 491.It Fl p 492Requests changing the passphrase of a private key file instead of 493creating a new private key. 494The program will prompt for the file 495containing the private key, for the old passphrase, and twice for the 496new passphrase. 497.It Fl Q 498Test whether keys have been revoked in a KRL. 499.It Fl q 500Silence 501.Nm ssh-keygen . 502Used by 503.Pa /etc/rc.d/sshd 504when creating a new key. 505.It Fl R Ar hostname 506Removes all keys belonging to 507.Ar hostname 508from a 509.Pa known_hosts 510file. 511This option is useful to delete hashed hosts (see the 512.Fl H 513option above). 514.It Fl r Ar hostname 515Print the SSHFP fingerprint resource record named 516.Ar hostname 517for the specified public key file. 518.It Fl S Ar start 519Specify start point (in hex) when generating candidate moduli for DH-GEX. 520.It Fl s Ar ca_key 521Certify (sign) a public key using the specified CA key. 522Please see the 523.Sx CERTIFICATES 524section for details. 525.Pp 526When generating a KRL, 527.Fl s 528specifies a path to a CA public key file used to revoke certificates directly 529by key ID or serial number. 530See the 531.Sx KEY REVOCATION LISTS 532section for details. 533.It Fl T Ar output_file 534Test DH group exchange candidate primes (generated using the 535.Fl G 536option) for safety. 537.It Fl t Cm dsa | ecdsa | ed25519 | rsa | rsa1 538Specifies the type of key to create. 539The possible values are 540.Dq rsa1 541for protocol version 1 and 542.Dq dsa , 543.Dq ecdsa , 544.Dq ed25519 , 545or 546.Dq rsa 547for protocol version 2. 548.It Fl u 549Update a KRL. 550When specified with 551.Fl k , 552keys listed via the command line are added to the existing KRL rather than 553a new KRL being created. 554.It Fl V Ar validity_interval 555Specify a validity interval when signing a certificate. 556A validity interval may consist of a single time, indicating that the 557certificate is valid beginning now and expiring at that time, or may consist 558of two times separated by a colon to indicate an explicit time interval. 559The start time may be specified as a date in YYYYMMDD format, a time 560in YYYYMMDDHHMMSS format or a relative time (to the current time) consisting 561of a minus sign followed by a relative time in the format described in the 562TIME FORMATS section of 563.Xr sshd_config 5 . 564The end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMMSS time or 565a relative time starting with a plus character. 566.Pp 567For example: 568.Dq +52w1d 569(valid from now to 52 weeks and one day from now), 570.Dq -4w:+4w 571(valid from four weeks ago to four weeks from now), 572.Dq 20100101123000:20110101123000 573(valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011), 574.Dq -1d:20110101 575(valid from yesterday to midnight, January 1st, 2011). 576.It Fl v 577Verbose mode. 578Causes 579.Nm 580to print debugging messages about its progress. 581This is helpful for debugging moduli generation. 582Multiple 583.Fl v 584options increase the verbosity. 585The maximum is 3. 586.It Fl W Ar generator 587Specify desired generator when testing candidate moduli for DH-GEX. 588.It Fl y 589This option will read a private 590OpenSSH format file and print an OpenSSH public key to stdout. 591.It Fl z Ar serial_number 592Specifies a serial number to be embedded in the certificate to distinguish 593this certificate from others from the same CA. 594The default serial number is zero. 595.Pp 596When generating a KRL, the 597.Fl z 598flag is used to specify a KRL version number. 599.El 600.Sh MODULI GENERATION 601.Nm 602may be used to generate groups for the Diffie-Hellman Group Exchange 603(DH-GEX) protocol. 604Generating these groups is a two-step process: first, candidate 605primes are generated using a fast, but memory intensive process. 606These candidate primes are then tested for suitability (a CPU-intensive 607process). 608.Pp 609Generation of primes is performed using the 610.Fl G 611option. 612The desired length of the primes may be specified by the 613.Fl b 614option. 615For example: 616.Pp 617.Dl # ssh-keygen -G moduli-2048.candidates -b 2048 618.Pp 619By default, the search for primes begins at a random point in the 620desired length range. 621This may be overridden using the 622.Fl S 623option, which specifies a different start point (in hex). 624.Pp 625Once a set of candidates have been generated, they must be screened for 626suitability. 627This may be performed using the 628.Fl T 629option. 630In this mode 631.Nm 632will read candidates from standard input (or a file specified using the 633.Fl f 634option). 635For example: 636.Pp 637.Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates 638.Pp 639By default, each candidate will be subjected to 100 primality tests. 640This may be overridden using the 641.Fl a 642option. 643The DH generator value will be chosen automatically for the 644prime under consideration. 645If a specific generator is desired, it may be requested using the 646.Fl W 647option. 648Valid generator values are 2, 3, and 5. 649.Pp 650Screened DH groups may be installed in 651.Pa /etc/moduli . 652It is important that this file contains moduli of a range of bit lengths and 653that both ends of a connection share common moduli. 654.Sh CERTIFICATES 655.Nm 656supports signing of keys to produce certificates that may be used for 657user or host authentication. 658Certificates consist of a public key, some identity information, zero or 659more principal (user or host) names and a set of options that 660are signed by a Certification Authority (CA) key. 661Clients or servers may then trust only the CA key and verify its signature 662on a certificate rather than trusting many user/host keys. 663Note that OpenSSH certificates are a different, and much simpler, format to 664the X.509 certificates used in 665.Xr ssl 8 . 666.Pp 667.Nm 668supports two types of certificates: user and host. 669User certificates authenticate users to servers, whereas host certificates 670authenticate server hosts to users. 671To generate a user certificate: 672.Pp 673.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub 674.Pp 675The resultant certificate will be placed in 676.Pa /path/to/user_key-cert.pub . 677A host certificate requires the 678.Fl h 679option: 680.Pp 681.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub 682.Pp 683The host certificate will be output to 684.Pa /path/to/host_key-cert.pub . 685.Pp 686It is possible to sign using a CA key stored in a PKCS#11 token by 687providing the token library using 688.Fl D 689and identifying the CA key by providing its public half as an argument 690to 691.Fl s : 692.Pp 693.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub 694.Pp 695In all cases, 696.Ar key_id 697is a "key identifier" that is logged by the server when the certificate 698is used for authentication. 699.Pp 700Certificates may be limited to be valid for a set of principal (user/host) 701names. 702By default, generated certificates are valid for all users or hosts. 703To generate a certificate for a specified set of principals: 704.Pp 705.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub 706.Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub" 707.Pp 708Additional limitations on the validity and use of user certificates may 709be specified through certificate options. 710A certificate option may disable features of the SSH session, may be 711valid only when presented from particular source addresses or may 712force the use of a specific command. 713For a list of valid certificate options, see the documentation for the 714.Fl O 715option above. 716.Pp 717Finally, certificates may be defined with a validity lifetime. 718The 719.Fl V 720option allows specification of certificate start and end times. 721A certificate that is presented at a time outside this range will not be 722considered valid. 723By default, certificates are valid from 724.Ux 725Epoch to the distant future. 726.Pp 727For certificates to be used for user or host authentication, the CA 728public key must be trusted by 729.Xr sshd 8 730or 731.Xr ssh 1 . 732Please refer to those manual pages for details. 733.Sh KEY REVOCATION LISTS 734.Nm 735is able to manage OpenSSH format Key Revocation Lists (KRLs). 736These binary files specify keys or certificates to be revoked using a 737compact format, taking as little as one bit per certificate if they are being 738revoked by serial number. 739.Pp 740KRLs may be generated using the 741.Fl k 742flag. 743This option reads one or more files from the command line and generates a new 744KRL. 745The files may either contain a KRL specification (see below) or public keys, 746listed one per line. 747Plain public keys are revoked by listing their hash or contents in the KRL and 748certificates revoked by serial number or key ID (if the serial is zero or 749not available). 750.Pp 751Revoking keys using a KRL specification offers explicit control over the 752types of record used to revoke keys and may be used to directly revoke 753certificates by serial number or key ID without having the complete original 754certificate on hand. 755A KRL specification consists of lines containing one of the following directives 756followed by a colon and some directive-specific information. 757.Bl -tag -width Ds 758.It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number 759Revokes a certificate with the specified serial number. 760Serial numbers are 64-bit values, not including zero and may be expressed 761in decimal, hex or octal. 762If two serial numbers are specified separated by a hyphen, then the range 763of serial numbers including and between each is revoked. 764The CA key must have been specified on the 765.Nm 766command line using the 767.Fl s 768option. 769.It Cm id : Ar key_id 770Revokes a certificate with the specified key ID string. 771The CA key must have been specified on the 772.Nm 773command line using the 774.Fl s 775option. 776.It Cm key : Ar public_key 777Revokes the specified key. 778If a certificate is listed, then it is revoked as a plain public key. 779.It Cm sha1 : Ar public_key 780Revokes the specified key by its SHA1 hash. 781.El 782.Pp 783KRLs may be updated using the 784.Fl u 785flag in addition to 786.Fl k . 787When this option is specified, keys listed via the command line are merged into 788the KRL, adding to those already there. 789.Pp 790It is also possible, given a KRL, to test whether it revokes a particular key 791(or keys). 792The 793.Fl Q 794flag will query an existing KRL, testing each key specified on the command line. 795If any key listed on the command line has been revoked (or an error encountered) 796then 797.Nm 798will exit with a non-zero exit status. 799A zero exit status will only be returned if no key was revoked. 800.Sh FILES 801.Bl -tag -width Ds -compact 802.It Pa ~/.ssh/identity 803Contains the protocol version 1 RSA authentication identity of the user. 804This file should not be readable by anyone but the user. 805It is possible to 806specify a passphrase when generating the key; that passphrase will be 807used to encrypt the private part of this file using 3DES. 808This file is not automatically accessed by 809.Nm 810but it is offered as the default file for the private key. 811.Xr ssh 1 812will read this file when a login attempt is made. 813.Pp 814.It Pa ~/.ssh/identity.pub 815Contains the protocol version 1 RSA public key for authentication. 816The contents of this file should be added to 817.Pa ~/.ssh/authorized_keys 818on all machines 819where the user wishes to log in using RSA authentication. 820There is no need to keep the contents of this file secret. 821.Pp 822.It Pa ~/.ssh/id_dsa 823.It Pa ~/.ssh/id_ecdsa 824.It Pa ~/.ssh/id_ed25519 825.It Pa ~/.ssh/id_rsa 826Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA 827authentication identity of the user. 828This file should not be readable by anyone but the user. 829It is possible to 830specify a passphrase when generating the key; that passphrase will be 831used to encrypt the private part of this file using 128-bit AES. 832This file is not automatically accessed by 833.Nm 834but it is offered as the default file for the private key. 835.Xr ssh 1 836will read this file when a login attempt is made. 837.Pp 838.It Pa ~/.ssh/id_dsa.pub 839.It Pa ~/.ssh/id_ecdsa.pub 840.It Pa ~/.ssh/id_ed25519.pub 841.It Pa ~/.ssh/id_rsa.pub 842Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA 843public key for authentication. 844The contents of this file should be added to 845.Pa ~/.ssh/authorized_keys 846on all machines 847where the user wishes to log in using public key authentication. 848There is no need to keep the contents of this file secret. 849.Pp 850.It Pa /etc/moduli 851Contains Diffie-Hellman groups used for DH-GEX. 852The file format is described in 853.Xr moduli 5 . 854.El 855.Sh SEE ALSO 856.Xr ssh 1 , 857.Xr ssh-add 1 , 858.Xr ssh-agent 1 , 859.Xr moduli 5 , 860.Xr sshd 8 861.Rs 862.%R RFC 4716 863.%T "The Secure Shell (SSH) Public Key File Format" 864.%D 2006 865.Re 866.Sh AUTHORS 867OpenSSH is a derivative of the original and free 868ssh 1.2.12 release by Tatu Ylonen. 869Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 870Theo de Raadt and Dug Song 871removed many bugs, re-added newer features and 872created OpenSSH. 873Markus Friedl contributed the support for SSH 874protocol versions 1.5 and 2.0. 875