show crypto key mypubkey rsa
Shows the RSA key pairs the device has generated, which SSH needs before it can start.
Written by a working field network engineer · CCNA, Security+, CySA+
Shows the device’s own RSA key pairs. SSH cannot start without one, and the key name tells you which hostname and domain name it was generated under.
Example output
R1#show crypto key mypubkey rsa
% Key pair was generated at: 09:02:17 UTC Nov 10 2026
Key name: R1.lab.local
Key type: RSA KEYS
Storage Device: not specified
Usage: General Purpose Key
Key is not exportable.
Key Data:
30820122 300D0609 2A864886 F70D0101 01050003 82010F00 3082010A 02820101
00C4A1F3 9B27E0D4 51C8A0E2 7F3B9D16 82E5C0A4 1D7B6F93 E2C84A05 B9D1E637Reference output: hand-written in standard Cisco IOS format for this example network, not captured from a device. Key data shortened: a 2048-bit key prints about nine lines.
Useful variants
crypto key generate rsa modulus 2048crypto key zeroize rsa
What each column or field means
| Field | Meaning |
|---|---|
Key name | hostname.domain-name at the time the key was generated. |
Usage | General Purpose Key unless you generated separate signing and encryption keys. |
Key is not exportable | The default; the private key cannot be copied off the device. |
Key Data | The public key in hexadecimal. Clients cache it to detect a changed device. |
When it doesn’t look right
“% Please define a domain-name first.” when generating the key.
Configure ip domain-name <name> (and a hostname other than the default) before crypto key generate rsa.
Clients warn that the host key changed.
The key was regenerated (or the hostname or domain changed and a new key was made). Confirm the change was yours before accepting it.
Related commands
Try it yourself
- Domain Name and RSA Key Generation (Pro)
- Secure Device Access (SSH) (Pro)
- Or build the example network in the free Sandbox
Learn it in the CCNA path
- Enable SSH with a domain name and RSA keys (5. Security Fundamentals)
Topic
SSH and Device Hardening — Replace Telnet with SSH: domain name, RSA keys, local users, VTY transport and login rules, and how to verify each one.