1 .\" $OpenBSD: ssh-keygen.1,v 1.232 2024/06/17 13:50:18 naddy Exp $
3 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 .\" All rights reserved
7 .\" As far as I am concerned, the code I have written for this software
8 .\" can be used freely for any purpose. Any derived versions of this
9 .\" software must be clearly marked as such, and if the derived work is
10 .\" incompatible with the protocol description in the RFC file, it must be
11 .\" called by a name other than "ssh" or "Secure Shell".
14 .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
15 .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
16 .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
18 .\" Redistribution and use in source and binary forms, with or without
19 .\" modification, are permitted provided that the following conditions
21 .\" 1. Redistributions of source code must retain the above copyright
22 .\" notice, this list of conditions and the following disclaimer.
23 .\" 2. Redistributions in binary form must reproduce the above copyright
24 .\" notice, this list of conditions and the following disclaimer in the
25 .\" documentation and/or other materials provided with the distribution.
27 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 .Dd $Mdocdate: June 17 2024 $
43 .Nd OpenSSH authentication key utility
50 .Op Fl f Ar output_keyfile
52 .Op Fl N Ar new_passphrase
54 .Op Fl t Cm ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
62 .Op Fl N Ar new_passphrase
63 .Op Fl P Ar old_passphrase
67 .Op Fl f Ar input_keyfile
68 .Op Fl m Ar key_format
71 .Op Fl f Ar input_keyfile
72 .Op Fl m Ar key_format
75 .Op Fl f Ar input_keyfile
81 .Op Fl P Ar passphrase
85 .Op Fl E Ar fingerprint_hash
86 .Op Fl f Ar input_keyfile
89 .Op Fl f Ar input_keyfile
95 .Op Fl f Ar known_hosts_file
98 .Op Fl f Ar known_hosts_file
105 .Op Fl f Ar known_hosts_file
109 .Op Fl f Ar input_keyfile
116 .Op Fl f Ar input_file
120 .Fl I Ar certificate_identity
123 .Op Fl D Ar pkcs11_provider
124 .Op Fl n Ar principals
126 .Op Fl V Ar validity_interval
127 .Op Fl z Ar serial_number
131 .Op Fl f Ar input_keyfile
135 .Op Fl f Ar prefix_path
140 .Op Fl s Ar ca_public
141 .Op Fl z Ar version_number
149 .Fl Y Cm find-principals
151 .Fl s Ar signature_file
152 .Fl f Ar allowed_signers_file
154 .Fl Y Cm match-principals
155 .Fl I Ar signer_identity
156 .Fl f Ar allowed_signers_file
158 .Fl Y Cm check-novalidate
161 .Fl s Ar signature_file
171 .Fl f Ar allowed_signers_file
172 .Fl I Ar signer_identity
174 .Fl s Ar signature_file
175 .Op Fl r Ar revocation_file
178 generates, manages and converts authentication keys for
181 can create keys for use by SSH protocol version 2.
183 The type of key to be generated is specified with the
186 If invoked without any arguments,
188 will generate an Ed25519 key.
191 is also used to generate groups for use in Diffie-Hellman group
194 .Sx MODULI GENERATION
199 can be used to generate and update Key Revocation Lists, and to test whether
200 given keys have been revoked by one.
202 .Sx KEY REVOCATION LISTS
205 Normally each user wishing to use SSH
206 with public key authentication runs this once to create the authentication
208 .Pa ~/.ssh/id_ecdsa ,
209 .Pa ~/.ssh/id_ecdsa_sk ,
210 .Pa ~/.ssh/id_ed25519 ,
211 .Pa ~/.ssh/id_ed25519_sk
214 Additionally, the system administrator may use this to generate host keys,
218 Normally this program generates the key and asks for a file in which
219 to store the private key.
220 The public key is stored in a file with the same name but
223 The program also asks for a passphrase.
224 The passphrase may be empty to indicate no passphrase
225 (host keys must have an empty passphrase), or it may be a string of
227 A passphrase is similar to a password, except it can be a phrase with a
228 series of words, punctuation, numbers, whitespace, or any string of
230 Good passphrases are 10-30 characters long, are
231 not simple sentences or otherwise easily guessable (English
232 prose has only 1-2 bits of entropy per character, and provides very bad
233 passphrases), and contain a mix of upper and lowercase letters,
234 numbers, and non-alphanumeric characters.
235 The passphrase can be changed later by using the
239 There is no way to recover a lost passphrase.
240 If the passphrase is lost or forgotten, a new key must be generated
241 and the corresponding public key copied to other machines.
244 will by default write keys in an OpenSSH-specific format.
245 This format is preferred as it offers better protection for
246 keys at rest as well as allowing storage of key comments within
247 the private key file itself.
248 The key comment may be useful to help identify the key.
249 The comment is initialized to
251 when the key is created, but can be changed using the
255 It is still possible for
257 to write the previously-used PEM format private keys using the
260 This may be used when generating new keys, and existing new-format
261 keys may be converted using this option in conjunction with the
263 (change passphrase) flag.
265 After a key is generated,
267 will ask where the keys
268 should be placed to be activated.
270 The options are as follows:
273 Generate host keys of all default key types (rsa, ecdsa, and
274 ed25519) if they do not already exist.
275 The host keys are generated with the default key file path,
276 an empty passphrase, default bits for the key type, and default comment.
279 has also been specified, its argument is used as a prefix to the
280 default path for the resulting host key files.
283 to generate new host keys.
285 When saving a private key, this option specifies the number of KDF
286 (key derivation function, currently
289 Higher numbers result in slower passphrase verification and increased
290 resistance to brute-force password cracking (should the keys be stolen).
291 The default is 16 rounds.
293 Show the bubblebabble digest of specified private or public key file.
295 Specifies the number of bits in the key to create.
296 For RSA keys, the minimum size is 1024 bits and the default is 3072 bits.
297 Generally, 3072 bits is considered sufficient.
300 flag determines the key length by selecting from one of three elliptic
301 curve sizes: 256, 384 or 521 bits.
302 Attempting to use bit lengths other than these three values for ECDSA keys
304 ECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length and the
306 flag will be ignored.
308 Provides a new comment.
310 Requests changing the comment in the private and public key files.
311 The program will prompt for the file containing the private keys, for
312 the passphrase if the key has one, and for the new comment.
314 Download the public keys provided by the PKCS#11 shared library
316 When used in combination with
318 this option indicates that a CA key resides in a PKCS#11 token (see the
320 section for details).
321 .It Fl E Ar fingerprint_hash
322 Specifies the hash algorithm used when displaying key fingerprints.
330 This option will read a private or public OpenSSH key file and
331 print to stdout a public key in one of the formats specified by the
334 The default export format is
336 This option allows exporting OpenSSH keys for use by other programs, including
337 several commercial SSH implementations.
338 .It Fl F Ar hostname | [hostname]:port
339 Search for the specified
341 (with optional port number)
344 file, listing any occurrences found.
345 This option is useful to find hashed host names or addresses and may also be
346 used in conjunction with the
348 option to print found keys in a hashed format.
350 Specifies the filename of the key file.
352 Use generic DNS format when printing fingerprint resource records using the
359 This replaces all hostnames and addresses with hashed representations
360 within the specified file; the original content is moved to a file with
362 These hashes may be used normally by
366 but they do not reveal identifying information should the file's contents
368 This option will not modify existing hashed hostnames and is therefore safe
369 to use on files that mix hashed and non-hashed names.
371 When signing a key, create a host certificate instead of a user
376 .It Fl I Ar certificate_identity
377 Specify the key identity when signing a public key.
382 This option will read an unencrypted private (or public) key file
383 in the format specified by the
385 option and print an OpenSSH compatible private
386 (or public) key to stdout.
387 This option allows importing keys from other software, including several
388 commercial SSH implementations.
389 The default import format is
392 Download resident keys from a FIDO authenticator.
393 Public and private key files will be written to the current directory for
395 If multiple FIDO authenticators are attached, keys will be downloaded from
396 the first touched authenticator.
398 .Sx FIDO AUTHENTICATOR
399 section for more information.
404 will generate a KRL file at the location specified via the
406 flag that revokes every key or certificate presented on the command line.
407 Keys/certificates to be revoked may be specified by public key file or
408 using the format described in the
409 .Sx KEY REVOCATION LISTS
412 Prints the contents of one or more certificates.
414 Show fingerprint of specified public key file.
416 will try to find the matching public key file and prints its fingerprint.
419 a visual ASCII art representation of the key is supplied with the
422 Generate candidate Diffie-Hellman Group Exchange (DH-GEX) parameters for
424 .Sq diffie-hellman-group-exchange-*
425 key exchange methods.
426 The numbers generated by this operation must be further screened before
429 .Sx MODULI GENERATION
430 section for more information.
432 Screen candidate parameters for Diffie-Hellman Group Exchange.
433 This will accept a list of candidate numbers and test that they are
434 safe (Sophie Germain) primes with acceptable group generators.
435 The results of this operation may be added to the
439 .Sx MODULI GENERATION
440 section for more information.
441 .It Fl m Ar key_format
442 Specify a key format for key generation, the
446 (export) conversion options, and the
448 change passphrase operation.
449 The latter may be used to convert between OpenSSH private key and PEM
451 The supported key formats are:
453 (RFC 4716/SSH2 public or private key),
455 (PKCS8 public or private key)
459 By default OpenSSH will write newly-generated private keys in its own
460 format, but when converting public keys for export the default format is
464 when generating or updating a supported private key type will cause the
465 key to be stored in the legacy PEM private key format.
466 .It Fl N Ar new_passphrase
467 Provides the new passphrase.
468 .It Fl n Ar principals
469 Specify one or more principals (user or host names) to be included in
470 a certificate when signing a key.
471 Multiple principals may be specified, separated by commas.
476 Specify a key/value option.
477 These are specific to the operation that
479 has been requested to perform.
481 When signing certificates, one of the options listed in the
483 section may be specified here.
485 When performing moduli generation or screening, one of the options
487 .Sx MODULI GENERATION
488 section may be specified.
490 When generating FIDO authenticator-backed keys, the options listed in the
491 .Sx FIDO AUTHENTICATOR
492 section may be specified.
494 When performing signature-related options using the
496 flag, the following options are accepted:
498 .It Cm hashalg Ns = Ns Ar algorithm
499 Selects the hash algorithm to use for hashing the message to be signed.
507 Print the full public key to standard output after signature verification.
508 .It Cm verify-time Ns = Ns Ar timestamp
509 Specifies a time to use when validating signatures instead of the current
511 The time may be specified as a date or time in the YYYYMMDD[Z] or
512 in YYYYMMDDHHMM[SS][Z] formats.
513 Dates and times will be interpreted in the current system time zone unless
514 suffixed with a Z character, which causes them to be interpreted in the
518 When generating SSHFP DNS records from public keys using the
520 flag, the following options are accepted:
522 .It Cm hashalg Ns = Ns Ar algorithm
523 Selects a hash algorithm to use when printing SSHFP records using the
530 The default is to print both.
535 option may be specified multiple times.
536 .It Fl P Ar passphrase
537 Provides the (old) passphrase.
539 Requests changing the passphrase of a private key file instead of
540 creating a new private key.
541 The program will prompt for the file
542 containing the private key, for the old passphrase, and twice for the
545 Test whether keys have been revoked in a KRL.
548 option is also specified then the contents of the KRL will be printed.
552 .It Fl R Ar hostname | [hostname]:port
553 Removes all keys belonging to the specified
555 (with optional port number)
559 This option is useful to delete hashed hosts (see the
563 Print the SSHFP fingerprint resource record named
565 for the specified public key file.
567 Certify (sign) a public key using the specified CA key.
572 When generating a KRL,
574 specifies a path to a CA public key file used to revoke certificates directly
575 by key ID or serial number.
577 .Sx KEY REVOCATION LISTS
579 .It Fl t Cm ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
580 Specifies the type of key to create.
581 The possible values are
589 This flag may also be used to specify the desired signature type when
590 signing certificates using an RSA CA key.
591 The available RSA signature variants are
593 (SHA1 signatures, not recommended),
599 When used in combination with
603 this option indicates that a CA key resides in a
607 section for more information.
612 keys listed via the command line are added to the existing KRL rather than
613 a new KRL being created.
614 .It Fl V Ar validity_interval
615 Specify a validity interval when signing a certificate.
616 A validity interval may consist of a single time, indicating that the
617 certificate is valid beginning now and expiring at that time, or may consist
618 of two times separated by a colon to indicate an explicit time interval.
620 The start time may be specified as:
625 to indicate the certificate has no specified start time.
627 A date or time in the system time zone formatted as YYYYMMDD or
630 A date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
632 A relative time before the current system time consisting of a minus sign
633 followed by an interval in the format described in the
634 TIME FORMATS section of
637 A raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
638 number beginning with
642 The end time may be specified similarly to the start time:
647 to indicate the certificate has no specified end time.
649 A date or time in the system time zone formatted as YYYYMMDD or
652 A date or time in the UTC time zone as YYYYMMDDZ or YYYYMMDDHHMM[SS]Z.
654 A relative time after the current system time consisting of a plus sign
655 followed by an interval in the format described in the
656 TIME FORMATS section of
659 A raw seconds since epoch (Jan 1 1970 00:00:00 UTC) as a hexadecimal
660 number beginning with
667 Valid from now to 52 weeks and one day from now.
669 Valid from four weeks ago to four weeks from now.
670 .It 20100101123000:20110101123000
671 Valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011.
672 .It 20100101123000Z:20110101123000Z
673 Similar, but interpreted in the UTC time zone rather than the system time zone.
675 Valid from yesterday to midnight, January 1st, 2011.
677 Valid from roughly early 1970 to May 2033.
679 Valid from one minute ago and never expiring.
685 to print debugging messages about its progress.
686 This is helpful for debugging moduli generation.
689 options increase the verbosity.
692 Specifies a path to a library that will be used when creating
693 FIDO authenticator-hosted keys, overriding the default of using
694 the internal USB HID support.
695 .It Fl Y Cm find-principals
696 Find the principal(s) associated with the public key of a signature,
699 flag in an authorized signers file provided using the
702 The format of the allowed signers file is documented in the
705 If one or more matching principals are found, they are returned on
707 .It Fl Y Cm match-principals
708 Find principal matching the principal name provided using the
710 flag in the authorized signers file specified using the
713 If one or more matching principals are found, they are returned on
715 .It Fl Y Cm check-novalidate
716 Checks that a signature generated using
719 has a valid structure.
720 This does not validate if a signature comes from an authorized signer.
721 When testing a signature,
723 accepts a message on standard input and a signature namespace using
725 A file containing the corresponding signature must also be supplied using the
728 Successful testing of the signature is signalled by
730 returning a zero exit status.
732 Cryptographically sign a file or some data using an SSH key.
735 accepts zero or more files to sign on the command-line - if no files
738 will sign data presented on standard input.
739 Signatures are written to the path of the input file with
741 appended, or to standard output if the message to be signed was read from
744 The key used for signing is specified using the
746 option and may refer to either a private key, or a public key with the private
749 An additional signature namespace, used to prevent signature confusion across
750 different domains of use (e.g. file signing vs email signing) must be provided
754 Namespaces are arbitrary strings, and may include:
759 For custom uses, it is recommended to use names following a
760 NAMESPACE@YOUR.DOMAIN pattern to generate unambiguous namespaces.
762 Request to verify a signature generated using
766 When verifying a signature,
768 accepts a message on standard input and a signature namespace using
770 A file containing the corresponding signature must also be supplied using the
772 flag, along with the identity of the signer using
774 and a list of allowed signers via the
777 The format of the allowed signers file is documented in the
780 A file containing revoked keys can be passed using the
783 The revocation file may be a KRL or a one-per-line list of public keys.
784 Successful verification by an authorized signer is signalled by
786 returning a zero exit status.
788 This option will read a private
789 OpenSSH format file and print an OpenSSH public key to stdout.
791 Specifies the cipher to use for encryption when writing an OpenSSH-format
793 The list of available ciphers may be obtained using
797 .It Fl z Ar serial_number
798 Specifies a serial number to be embedded in the certificate to distinguish
799 this certificate from others from the same CA.
804 character, then the serial number will be incremented for each certificate
805 signed on a single command-line.
806 The default serial number is zero.
808 When generating a KRL, the
810 flag is used to specify a KRL version number.
812 .Sh MODULI GENERATION
814 may be used to generate groups for the Diffie-Hellman Group Exchange
816 Generating these groups is a two-step process: first, candidate
817 primes are generated using a fast, but memory intensive process.
818 These candidate primes are then tested for suitability (a CPU-intensive
821 Generation of primes is performed using the
824 The desired length of the primes may be specified by the
829 .Dl # ssh-keygen -M generate -O bits=2048 moduli-2048.candidates
831 By default, the search for primes begins at a random point in the
832 desired length range.
833 This may be overridden using the
835 option, which specifies a different start point (in hex).
837 Once a set of candidates have been generated, they must be screened for
839 This may be performed using the
844 will read candidates from standard input (or a file specified using the
849 .Dl # ssh-keygen -M screen -f moduli-2048.candidates moduli-2048
851 By default, each candidate will be subjected to 100 primality tests.
852 This may be overridden using the
855 The DH generator value will be chosen automatically for the
856 prime under consideration.
857 If a specific generator is desired, it may be requested using the
860 Valid generator values are 2, 3, and 5.
862 Screened DH groups may be installed in
864 It is important that this file contains moduli of a range of bit lengths.
866 A number of options are available for moduli generation and screening via the
870 .It Ic lines Ns = Ns Ar number
871 Exit after screening the specified number of lines while performing DH
873 .It Ic start-line Ns = Ns Ar line-number
874 Start screening at the specified line number while performing DH candidate
876 .It Ic checkpoint Ns = Ns Ar filename
877 Write the last line processed to the specified file while performing DH
879 This will be used to skip lines in the input file that have already been
880 processed if the job is restarted.
881 .It Ic memory Ns = Ns Ar mbytes
882 Specify the amount of memory to use (in megabytes) when generating
883 candidate moduli for DH-GEX.
884 .It Ic start Ns = Ns Ar hex-value
885 Specify start point (in hex) when generating candidate moduli for DH-GEX.
886 .It Ic generator Ns = Ns Ar value
887 Specify desired generator (in decimal) when testing candidate moduli for DH-GEX.
891 supports signing of keys to produce certificates that may be used for
892 user or host authentication.
893 Certificates consist of a public key, some identity information, zero or
894 more principal (user or host) names and a set of options that
895 are signed by a Certification Authority (CA) key.
896 Clients or servers may then trust only the CA key and verify its signature
897 on a certificate rather than trusting many user/host keys.
898 Note that OpenSSH certificates are a different, and much simpler, format to
899 the X.509 certificates used in
903 supports two types of certificates: user and host.
904 User certificates authenticate users to servers, whereas host certificates
905 authenticate server hosts to users.
906 To generate a user certificate:
908 .Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub
910 The resultant certificate will be placed in
911 .Pa /path/to/user_key-cert.pub .
912 A host certificate requires the
916 .Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub
918 The host certificate will be output to
919 .Pa /path/to/host_key-cert.pub .
921 It is possible to sign using a CA key stored in a PKCS#11 token by
922 providing the token library using
924 and identifying the CA key by providing its public half as an argument
928 .Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
930 Similarly, it is possible for the CA key to be hosted in a
932 This is indicated by the
934 flag and, again, the CA key must be identified by its public half.
936 .Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
940 is a "key identifier" that is logged by the server when the certificate
941 is used for authentication.
943 Certificates may be limited to be valid for a set of principal (user/host)
945 By default, generated certificates are valid for all users or hosts.
946 To generate a certificate for a specified set of principals:
948 .Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub
949 .Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain host_key.pub"
951 Additional limitations on the validity and use of user certificates may
952 be specified through certificate options.
953 A certificate option may disable features of the SSH session, may be
954 valid only when presented from particular source addresses or may
955 force the use of a specific command.
957 The options that are valid for user certificates are:
959 .Bl -tag -width Ds -compact
961 Clear all enabled permissions.
962 This is useful for clearing the default set of permissions so permissions may
963 be added individually.
965 .It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
966 .It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
967 Includes an arbitrary certificate critical option or extension.
970 should include a domain suffix, e.g.\&
971 .Dq name@example.com .
974 is specified then it is included as the contents of the extension/option
975 encoded as a string, otherwise the extension/option is created with no
976 contents (usually indicating a flag).
977 Extensions may be ignored by a client or server that does not recognise them,
978 whereas unknown critical options will cause the certificate to be refused.
980 .It Ic force-command Ns = Ns Ar command
981 Forces the execution of
983 instead of any shell or command specified by the user when
984 the certificate is used for authentication.
986 .It Ic no-agent-forwarding
989 forwarding (permitted by default).
991 .It Ic no-port-forwarding
992 Disable port forwarding (permitted by default).
995 Disable PTY allocation (permitted by default).
1002 (permitted by default).
1004 .It Ic no-x11-forwarding
1005 Disable X11 forwarding (permitted by default).
1007 .It Ic permit-agent-forwarding
1012 .It Ic permit-port-forwarding
1013 Allows port forwarding.
1016 Allows PTY allocation.
1018 .It Ic permit-user-rc
1024 .It Ic permit-X11-forwarding
1025 Allows X11 forwarding.
1027 .It Ic no-touch-required
1028 Do not require signatures made using this key include demonstration
1029 of user presence (e.g. by having the user touch the authenticator).
1030 This option only makes sense for the FIDO authenticator algorithms
1035 .It Ic source-address Ns = Ns Ar address_list
1036 Restrict the source addresses from which the certificate is considered valid.
1039 is a comma-separated list of one or more address/netmask pairs in CIDR
1042 .It Ic verify-required
1043 Require signatures made using this key indicate that the user was first
1045 This option only makes sense for the FIDO authenticator algorithms
1049 Currently PIN authentication is the only supported verification method,
1050 but other methods may be supported in the future.
1053 At present, no standard options are valid for host keys.
1055 Finally, certificates may be defined with a validity lifetime.
1058 option allows specification of certificate start and end times.
1059 A certificate that is presented at a time outside this range will not be
1061 By default, certificates are valid from the
1063 Epoch to the distant future.
1065 For certificates to be used for user or host authentication, the CA
1066 public key must be trusted by
1070 Refer to those manual pages for details.
1071 .Sh FIDO AUTHENTICATOR
1073 is able to generate FIDO authenticator-backed keys, after which
1074 they may be used much like any other key type supported by OpenSSH, so
1075 long as the hardware authenticator is attached when the keys are used.
1076 FIDO authenticators generally require the user to explicitly authorise
1077 operations by touching or tapping them.
1078 FIDO keys consist of two parts: a key handle part stored in the
1079 private key file on disk, and a per-device private key that is unique
1080 to each FIDO authenticator and that cannot be exported from the
1081 authenticator hardware.
1082 These are combined by the hardware at authentication time to derive
1083 the real key that is used to sign authentication challenges.
1084 Supported key types are
1089 The options that are valid for FIDO keys are:
1092 Override the default FIDO application/origin string of
1094 This may be useful when generating host or domain-specific resident keys.
1095 The specified application string must begin with
1097 .It Cm challenge Ns = Ns Ar path
1098 Specifies a path to a challenge string that will be passed to the
1099 FIDO authenticator during key generation.
1100 The challenge string may be used as part of an out-of-band
1101 protocol for key enrollment
1102 (a random challenge is used by default).
1104 Explicitly specify a
1106 device to use, rather than letting the authenticator middleware select one.
1107 .It Cm no-touch-required
1108 Indicate that the generated private key should not require touch
1109 events (user presence) when making signatures.
1112 will refuse such signatures by default, unless overridden via
1113 an authorized_keys option.
1115 Indicate that the key handle should be stored on the FIDO
1116 authenticator itself.
1117 This makes it easier to use the authenticator on multiple computers.
1118 Resident keys may be supported on FIDO2 authenticators and typically
1119 require that a PIN be set on the authenticator prior to generation.
1120 Resident keys may be loaded off the authenticator using
1122 Storing both parts of a key on a FIDO authenticator increases the likelihood
1123 of an attacker being able to use a stolen authenticator device.
1125 A username to be associated with a resident key,
1126 overriding the empty default username.
1127 Specifying a username may be useful when generating multiple resident keys
1128 for the same application name.
1129 .It Cm verify-required
1130 Indicate that this private key should require user verification for
1132 Not all FIDO authenticators support this option.
1133 Currently PIN authentication is the only supported verification method,
1134 but other methods may be supported in the future.
1135 .It Cm write-attestation Ns = Ns Ar path
1136 May be used at key generation time to record the attestation data
1137 returned from FIDO authenticators during key generation.
1138 This information is potentially sensitive.
1139 By default, this information is discarded.
1141 .Sh KEY REVOCATION LISTS
1143 is able to manage OpenSSH format Key Revocation Lists (KRLs).
1144 These binary files specify keys or certificates to be revoked using a
1145 compact format, taking as little as one bit per certificate if they are being
1146 revoked by serial number.
1148 KRLs may be generated using the
1151 This option reads one or more files from the command line and generates a new
1153 The files may either contain a KRL specification (see below) or public keys,
1154 listed one per line.
1155 Plain public keys are revoked by listing their hash or contents in the KRL and
1156 certificates revoked by serial number or key ID (if the serial is zero or
1159 Revoking keys using a KRL specification offers explicit control over the
1160 types of record used to revoke keys and may be used to directly revoke
1161 certificates by serial number or key ID without having the complete original
1162 certificate on hand.
1163 A KRL specification consists of lines containing one of the following directives
1164 followed by a colon and some directive-specific information.
1166 .It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
1167 Revokes a certificate with the specified serial number.
1168 Serial numbers are 64-bit values, not including zero and may be expressed
1169 in decimal, hex or octal.
1170 If two serial numbers are specified separated by a hyphen, then the range
1171 of serial numbers including and between each is revoked.
1172 The CA key must have been specified on the
1174 command line using the
1177 .It Cm id : Ar key_id
1178 Revokes a certificate with the specified key ID string.
1179 The CA key must have been specified on the
1181 command line using the
1184 .It Cm key : Ar public_key
1185 Revokes the specified key.
1186 If a certificate is listed, then it is revoked as a plain public key.
1187 .It Cm sha1 : Ar public_key
1188 Revokes the specified key by including its SHA1 hash in the KRL.
1189 .It Cm sha256 : Ar public_key
1190 Revokes the specified key by including its SHA256 hash in the KRL.
1191 KRLs that revoke keys by SHA256 hash are not supported by OpenSSH versions
1193 .It Cm hash : Ar fingerprint
1194 Revokes a key using a fingerprint hash, as obtained from a
1196 authentication log message or the
1200 Only SHA256 fingerprints are supported here and resultant KRLs are
1201 not supported by OpenSSH versions prior to 7.9.
1204 KRLs may be updated using the
1208 When this option is specified, keys listed via the command line are merged into
1209 the KRL, adding to those already there.
1211 It is also possible, given a KRL, to test whether it revokes a particular key
1215 flag will query an existing KRL, testing each key specified on the command line.
1216 If any key listed on the command line has been revoked (or an error encountered)
1219 will exit with a non-zero exit status.
1220 A zero exit status will only be returned if no key was revoked.
1222 When verifying signatures,
1224 uses a simple list of identities and keys to determine whether a signature
1225 comes from an authorized source.
1226 This "allowed signers" file uses a format patterned after the
1227 AUTHORIZED_KEYS FILE FORMAT described in
1229 Each line of the file contains the following space-separated fields:
1230 principals, options, keytype, base64-encoded key.
1231 Empty lines and lines starting with a
1233 are ignored as comments.
1235 The principals field is a pattern-list (see PATTERNS in
1237 consisting of one or more comma-separated USER@DOMAIN identity patterns
1238 that are accepted for signing.
1239 When verifying, the identity presented via the
1241 option must match a principals pattern in order for the corresponding key to be
1242 considered acceptable for verification.
1244 The options (if present) consist of comma-separated option specifications.
1245 No spaces are permitted, except within double quotes.
1246 The following option specifications are supported (note that option keywords
1247 are case-insensitive):
1249 .It Cm cert-authority
1250 Indicates that this key is accepted as a certificate authority (CA) and
1251 that certificates signed by this CA may be accepted for verification.
1252 .It Cm namespaces Ns = Ns "namespace-list"
1253 Specifies a pattern-list of namespaces that are accepted for this key.
1254 If this option is present, the signature namespace embedded in the
1255 signature object and presented on the verification command-line must
1256 match the specified list before the key will be considered acceptable.
1257 .It Cm valid-after Ns = Ns "timestamp"
1258 Indicates that the key is valid for use at or after the specified timestamp,
1259 which may be a date or time in the YYYYMMDD[Z] or YYYYMMDDHHMM[SS][Z] formats.
1260 Dates and times will be interpreted in the current system time zone unless
1261 suffixed with a Z character, which causes them to be interpreted in the UTC
1263 .It Cm valid-before Ns = Ns "timestamp"
1264 Indicates that the key is valid for use at or before the specified timestamp.
1267 When verifying signatures made by certificates, the expected principal
1268 name must match both the principals pattern in the allowed signers file and
1269 the principals embedded in the certificate itself.
1271 An example allowed signers file:
1272 .Bd -literal -offset 3n
1273 # Comments allowed at start of line
1274 user1@example.com,user2@example.com ssh-rsa AAAAX1...
1275 # A certificate authority, trusted for all principals in a domain.
1276 *@example.com cert-authority ssh-ed25519 AAAB4...
1277 # A key that is accepted only for file signing.
1278 user2@example.com namespaces="file" ssh-ed25519 AAA41...
1282 .It Ev SSH_SK_PROVIDER
1283 Specifies a path to a library that will be used when loading any
1284 FIDO authenticator-hosted keys, overriding the default of using
1285 the built-in USB HID support.
1288 .Bl -tag -width Ds -compact
1289 .It Pa ~/.ssh/id_ecdsa
1290 .It Pa ~/.ssh/id_ecdsa_sk
1291 .It Pa ~/.ssh/id_ed25519
1292 .It Pa ~/.ssh/id_ed25519_sk
1293 .It Pa ~/.ssh/id_rsa
1294 Contains the ECDSA, authenticator-hosted ECDSA, Ed25519,
1295 authenticator-hosted Ed25519 or RSA authentication identity of the user.
1296 This file should not be readable by anyone but the user.
1298 specify a passphrase when generating the key; that passphrase will be
1299 used to encrypt the private part of this file using 128-bit AES.
1300 This file is not automatically accessed by
1302 but it is offered as the default file for the private key.
1304 will read this file when a login attempt is made.
1306 .It Pa ~/.ssh/id_ecdsa.pub
1307 .It Pa ~/.ssh/id_ecdsa_sk.pub
1308 .It Pa ~/.ssh/id_ed25519.pub
1309 .It Pa ~/.ssh/id_ed25519_sk.pub
1310 .It Pa ~/.ssh/id_rsa.pub
1311 Contains the ECDSA, authenticator-hosted ECDSA, Ed25519,
1312 authenticator-hosted Ed25519 or RSA public key for authentication.
1313 The contents of this file should be added to
1314 .Pa ~/.ssh/authorized_keys
1316 where the user wishes to log in using public key authentication.
1317 There is no need to keep the contents of this file secret.
1320 Contains Diffie-Hellman groups used for DH-GEX.
1321 The file format is described in
1332 .%T "The Secure Shell (SSH) Public Key File Format"
1336 OpenSSH is a derivative of the original and free
1337 ssh 1.2.12 release by Tatu Ylonen.
1338 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1339 Theo de Raadt and Dug Song
1340 removed many bugs, re-added newer features and
1342 Markus Friedl contributed the support for SSH
1343 protocol versions 1.5 and 2.0.