Cisco routers and switches that run SSH generate their own RSA key pair on the device with the crypto key generate rsa command, and the private half stays inside NVRAM. Engineers who want to see the PEM bytes, prepare a key offline, or simply understand what an RSA key pair looks like before they configure it can generate an RSA-OAEP key pair in their browser for inspection and lab work, since Cisco IOS does not import browser-generated PEM into its SSH server. The RSA Key Generator produces a fresh 2048- or 3072-bit RSA-OAEP key pair with SHA-256 using the browser's native Web Cryptography implementation, exports the public half as SubjectPublicKeyInfo PEM and the private half as unencrypted PKCS#8 PEM, and never transmits the key material to any server. The two large primes and the fixed public exponent 65537 are generated locally; the public PEM begins with -----BEGIN PUBLIC KEY----- and the private PEM begins with -----BEGIN PRIVATE KEY-----, both wrapped at 64 columns per RFC 7468.

What Cisco SSH Requires from an RSA Key
Cisco IOS, IOS-XE, and NX-OS all rely on an RSA key pair to negotiate SSH version 2 sessions. Without an RSA key on the box, the SSH server refuses to start, which is why every Cisco SSH configuration guide begins with key generation. The on-device command looks like this in configuration mode: first set a hostname and an IP domain name because Cisco uses both to build the key label, then run crypto key generate rsa general-keys modulus 2048. The modulus value controls the key size: 2048 is the modern baseline, while 3072 is allowed on newer images and offers more headroom at the cost of slower handshake performance. Some platforms still accept 1024-bit keys, but Cisco's own security guidance treats that size as legacy and recommends replacing it before the next audit cycle.
The on-device generator writes the private key into NVRAM under a hidden file in the device's secure storage area, never as a portable PEM. That design keeps the key inside the hardware, but it also means you cannot easily copy the bytes off the box to inspect them, which is exactly the gap that drives many admins to look for an offline generator. For a deeper walkthrough of the Cisco-side command sequence, the Cisco switch key generation guide covers the same tool from a switch-only angle.
Generate the RSA Key Pair in Your Browser
The RSA Key Generator creates a real RSA key pair in your browser tab without uploading anything. Use it when you want to learn what the PEM looks like, prepare a key for a lab environment, or compare modulus sizes before deciding which one to commit on the production switch. The full procedure is short and follows the same parameter pattern recommended by the RFC 8017 specification for RSA-OAEP operations.
- Confirm the target application expects RSA-OAEP with SHA-256 and either the SPKI public envelope or the PKCS#8 private envelope. Cisco IOS itself does not import these envelopes directly into its SSH server, so use this workflow for lab, test, or inspection purposes rather than as a drop-in replacement for crypto key generate rsa.
- Open the RSA Key Generator in a modern desktop browser. Choose 2048 bits for broad compatibility, or 3072 bits when the recipient platform supports the larger modulus and you can accept the longer generation time. The tool does not offer 1024-bit keys because that modulus size is no longer considered safe.
- Click generate and wait. 2048-bit generation typically completes within a second; 3072-bit generation can take noticeably longer because the Web Cryptography implementation has to find two larger primes and validate them against exponent 65537.
- Copy the public PEM, the block starting with -----BEGIN PUBLIC KEY-----, and share it only with systems that need to encrypt for the holder. The private PEM, the block starting with -----BEGIN PRIVATE KEY-----, is unencrypted PKCS#8 and must be moved directly into protected storage such as a hardware security module, an encrypted keystore, or a managed secret vault.
- Perform an end-to-end encryption test before relying on the pair. Encrypt a short UTF-8 message with the public key, then decrypt the ciphertext with the private key inside the same tool and confirm the original text returns byte-for-byte. A PEM that imports cleanly is not enough on its own; the round trip proves the parameters match.
Configure SSH on the Cisco Router or Switch
Once you understand what the RSA pair looks like, the IOS configuration is short and reversible. The sequence is well established in Cisco's own configuration guides and works on IOS, IOS-XE, and most NX-OS releases that support SSHv2.
Run ip ssh version 2 in global configuration to disable legacy SSHv1, which has been considered insecure for years. Pin the SSH server to the key pair with ip ssh rsa keypair-name, where the name matches the hostname and domain name you set during key generation. Create a local user with username admin privilege 15 secret followed by a strong password, then move to the VTY lines: line vty 0 15, transport input ssh to drop Telnet, login local to require the local user database, and exec-timeout 15 0 to close idle sessions after fifteen minutes. Save the configuration with write memory only after SSH is confirmed to work; otherwise a failed SSH configuration can lock you out of the remote session.
Test the new SSH server from another machine before closing the console session by running ssh -o PreferredAuthentications=password [email protected] from a workstation that can reach the device. A successful password prompt and a working shell confirm the RSA key is in place and the VTY lines are answering.
Key Sizes, Formats, and Trade-offs
| Modulus size | Generation time (browser) | Cisco IOS support | Practical use |
|---|---|---|---|
| 1024 bits | Not offered | Legacy only | Avoid; below modern guidance |
| 2048 bits | Fast (typically under a second) | Universal on IOS 12.x+ and later | Default baseline for SSHv2 |
| 3072 bits | Slower (several seconds) | Available on most modern IOS, IOS-XE, and NX-OS | Higher security margin, slower handshake |
The numbers in the generation time column describe direction and rough magnitude only; exact timings vary by device CPU, browser version, and entropy source. Run the tool yourself to get the precise figure for your machine.
For SSH specifically, 2048 bits is the right default for nearly every Cisco deployment today. Move to 3072 only when the platform explicitly supports it and the slightly slower handshake is acceptable. Both sizes use the same RSA primitive, so the bytes you see in the public PEM are structurally identical between the two options apart from the modulus length recorded inside the ASN.1 structure.
Honest Limits of Browser-Generated Keys for Cisco
The RSA Key Generator is built around RSA-OAEP encryption, which is the right choice for many off-the-shelf applications but is not the same use case as SSH server signatures. Cisco's SSH implementation expects the device to hold the RSA key in its own secure storage and to use it for SSHv2 handshake signatures, not for OAEP encryption. The PEM blocks you get from the generator are valid RSA key material with SHA-256 declared as the hash, but they are not formatted as OpenSSH authorized_keys lines and they are not drop-in replacements for the keys Cisco IOS creates internally with crypto key generate rsa.
That gap matters, so the honest workflow looks like this. Use the RSA Key Generator to learn what an RSA key pair looks like, to test OAEP round trips in a lab, and to produce SPKI or PKCS#8 envelopes for applications that accept them. For production SSH on a real Cisco router or switch, plan on running crypto key generate rsa on the device itself. The two workflows complement each other rather than compete: the browser tool teaches the structure, the on-device command enforces the platform's hardware-backed storage model.
If you ever need to import a key into a system that does accept PEM (for example, an AAA server, an IKE peer configuration, or a Linux SSH client that supports PEM-formatted host keys), move the private PEM directly into the destination's protected storage, never paste it into a chat window, an issue tracker, a browser-synced note, or source control, and rotate the key the moment exposure is suspected. The output is kept only in the page's component memory until the tab is closed or the page is replaced, so closing the tab and clearing clipboard history are part of the workflow, not optional hygiene.
If you're weighing options, Create RSA Keys to Enable SSH: PEM vs OpenSSH covers this in detail.