RSA Key Conversion
{{ keySummary || '—' }}
{{ summarySecondaryLine }}
{{ keyBits }}-bit RSA {{ keyKind }} key {{ isAutoOutput ? 'Requested Auto' : outputLabel }} {{ resolvedOutputLabel }} Encrypted input Pin {{ fingerprintShort }}
RSA {{ rsaPrefieldStage.inputLabel }} {{ rsaPrefieldStage.keySizeLabel }} {{ rsaPrefieldStage.outputLabel }}
RSA key converter inputs
Accepted headers: PRIVATE KEY, RSA PRIVATE KEY, PUBLIC KEY, or RSA PUBLIC KEY.
Drop a PEM, KEY, PUB, or TXT RSA key onto the textarea.
Auto is the default: private RSA input exports PKCS#8 private PEM, public RSA input exports SPKI public PEM. Encrypted PKCS#8 requires a manual passphrase choice.
Enter 16-128 characters; leave 64 unless the target importer requires another width.
chars
Leave blank unless the input is encrypted or the selected output is encrypted PKCS#8.
{{ passphraseRevealStatus }}
Off accepts common whitespace; on rejects non-base64 payload characters.
{{ strictB64 ? 'On' : 'Off' }}
Field Value Copy
{{ row[0] }} {{ row[1] }}
No RSA key details available.
Target PEM header Key material Status Handoff note Copy
{{ row.target }} {{ row.pemHeader }} {{ row.keyMaterial }} {{ row.status }} {{ row.handoff }}
No format readiness data available.
{{ outputText }}
Check Value Copy
{{ row[0] }} {{ row[1] }}

                
Customize
Advanced
:

Introduction

The boundary line at the top of an RSA PEM block can decide whether a key imports cleanly or fails before any cryptographic check begins. A file that starts with PRIVATE KEY is not shaped the same way as one that starts with RSA PRIVATE KEY, even when both carry the same RSA private values. Public keys have the same problem: PUBLIC KEY and RSA PUBLIC KEY point to different encoded structures.

That distinction matters during certificate work, cloud setup, CI secrets, SSH-adjacent migrations, and handoffs between older and newer tooling. RSA itself is defined by the key numbers, especially the modulus n and public exponent e. PEM is the text armor around encoded bytes, and the wrapper tells the receiving parser how to read those bytes. A wrapper conversion can fix compatibility, but it does not rotate a key, strengthen a small modulus, or turn public material into private material.

Common RSA PEM labels and what they mean
PEM label Container meaning Typical confusion
RSA PRIVATE KEY PKCS#1 RSA-specific private-key structure. Often produced by older RSA workflows and rejected by software expecting PKCS#8.
PRIVATE KEY Unencrypted PKCS#8 private-key container with algorithm identity. Looks generic because the RSA identity lives inside the encoded structure.
ENCRYPTED PRIVATE KEY Passphrase-protected PKCS#8 private-key container. The passphrase protects the wrapper at rest; it is not a new RSA keypair.
PUBLIC KEY SubjectPublicKeyInfo, the generic public-key structure used by certificate tooling. Sometimes requested when only public material should be shared.
RSA PUBLIC KEY PKCS#1 RSA-specific public-key structure. Useful for older consumers, but not interchangeable with the generic public label.
RSA key material rewrapped into private and public PEM containers A central RSA key identity branches to PKCS#1 private, PKCS#8 private, encrypted PKCS#8, SPKI public, and PKCS#1 public PEM containers. RSA key identity modulus n and exponent e PKCS#1 private RSA PRIVATE KEY PKCS#8 private PRIVATE KEY encrypted PKCS#8 ENCRYPTED PRIVATE KEY SPKI public PUBLIC KEY PKCS#1 public RSA PUBLIC KEY

PKCS#1 is RSA-specific. PKCS#8 is a broader private-key container that can carry RSA and other algorithms. SubjectPublicKeyInfo, often shortened to SPKI, is the generic public-key structure used in X.509 and many certificate-related interfaces. PEM wraps those structures as readable text with BEGIN and END lines, but the real compatibility decision is the decoded structure inside.

The most important safety boundary is one-way. A private RSA key contains the public numbers, so public output can be derived from private input. A public key does not contain the private exponent or prime factors, so no wrapper conversion can recreate private material from a public block.

How to Use This Tool:

Use the first pass as a key inspection step. Convert only after the detected type, key size, and fingerprints match the key you intended to handle.

  1. Paste one complete RSA PEM block, or use Browse key file to load a .pem, .key, .pub, or text file. Keep the header, footer, and base64 body together.
  2. Leave Output format on Auto by key material or choose Info only when you want inspection without converted PEM output.
    Auto exports private RSA input as unencrypted PKCS#8 private PEM and public RSA input as SPKI public PEM. Choose encrypted PKCS#8 manually when passphrase protection is required.
  3. Review RSA Key Details. Confirm the detected input label, private or public kind, key size, public exponent, modulus SHA-256 digest, and SPKI pin before copying any output.
  4. Open Advanced when the input is encrypted, when encrypted PKCS#8 output is selected, or when a destination needs a non-default PEM line width. Enter the passphrase only for those cases.
  5. Choose a private target only for private input. Use PKCS#1 private for RSA PRIVATE KEY, PKCS#8 private for PRIVATE KEY, or PKCS#8 encrypted for ENCRYPTED PRIVATE KEY.
    If the parsed key is public only, private targets should remain unavailable. Find the original private key instead of trying to convert public material into a private key.
  6. Choose a public target when the destination should receive public material only. SPKI public writes PUBLIC KEY, while PKCS#1 public writes RSA PUBLIC KEY.
  7. Check Format Readiness and the Conversion Trace before copying the converted PEM or downloading files. Turn on Strict base64 parsing when pasted text may contain stray characters, damaged boundaries, or email quoting.

Interpreting Results:

Detected Input is the parsed container, not a guess from the filename. Key Kind controls the conversion direction: private input can produce private or public wrappers, while public input can only produce public wrappers. Key Size (bits) is the bit length of the RSA modulus, so it helps spot old or policy-incompatible keys but does not prove the key is still trusted.

RSA converter result cues and follow-up checks
Result cue Meaning What to do next
Private The parsed RSA material includes private values and the matching public values. Handle pasted text, converted output, clipboard copies, and downloads as secrets.
Public The parsed material includes only the modulus and public exponent. Use public targets only, or locate the original private key for private output.
Needs passphrase The input or selected encrypted output cannot proceed without a passphrase. Enter the intended passphrase, then clear it when the handoff is complete.
Unavailable The selected target requires private input that is not present. Switch to a public wrapper or stop and retrieve the private key from its owner.
Same fingerprints, different PEM label The public identity stayed aligned while the container changed. Confirm the destination asked for the new label before replacing a working file.

Modulus SHA-256 (hex) is useful when two RSA files should share the same public number n. SPKI pin (sha256/base64) is useful when software compares the generic public-key structure, as in certificate and application pinning contexts. These checks do not compare private-key encryption settings, comments, filenames, or certificate metadata.

Do not judge equality by PEM line breaks alone. The same decoded key can be wrapped at a different base64 width, stored under a different label, or protected by an encrypted private-key envelope that changes the visible body completely.

Technical Details:

RSA public identity is the pair n and e. The modulus n determines the nominal key size, and the public exponent e is commonly 65537. An RSA private key adds the private exponent and prime-factor values needed for signing and decryption. A private key can therefore reveal its public key, but a public key cannot reveal the private values.

PEM is a textual encoding convention for binary structures. The body is base64 text, while the boundary label tells the reader which ASN.1 structure to expect after decoding. PKCS#1 defines RSA-specific public and private key structures. PKCS#8 defines a private-key container with algorithm identity. SubjectPublicKeyInfo carries public key material with the algorithm identifier used by X.509 and many import APIs.

Transformation Core:

RSA PEM transformation map
Target wrapper PEM boundary label Encoded structure Private input required
PKCS#1 private RSA PRIVATE KEY RSA private key with public and private RSA values. Yes
PKCS#8 private PRIVATE KEY Generic private-key container carrying an RSA private key. Yes
Encrypted PKCS#8 private ENCRYPTED PRIVATE KEY Passphrase-protected generic private-key container. Yes
SPKI public PUBLIC KEY Generic public-key structure with RSA algorithm identity. No
PKCS#1 public RSA PUBLIC KEY RSA-specific public key containing modulus and exponent. No

The conversion path is structural. The PEM body is decoded, the RSA key is parsed, the requested target structure is serialized, and the bytes are written back as PEM with the selected line width. When encrypted PKCS#8 output is selected, the private-key container is encrypted with a passphrase before the PEM text is built. The passphrase protects the exported container at rest, but it does not replace access control, secret storage, or key rotation.

RSA identity checks and boundaries
Check Derived from Best use Boundary
Key size Bit length of the modulus n. Screening for very old or policy-incompatible RSA keys. Does not prove safe generation, current trust, or acceptable use period.
Public exponent The public exponent e. Spotting unusual public parameters during review. A familiar exponent does not prove the private key is well protected.
Modulus SHA-256 SHA-256 digest of the RSA modulus bytes. Comparing RSA key files that should contain the same public number. RSA-specific and not a full certificate or wrapper comparison.
SPKI pin SHA-256 digest of DER-encoded SubjectPublicKeyInfo, shown in base64. Comparing public-key identity in certificate and application contexts. Tracks public key structure, not private-key encryption or file permissions.

Strict base64 parsing is a guard against damaged PEM text. It rejects empty payloads, invalid base64 characters, incomplete boundary pairs, and payload lengths that cannot decode cleanly. Leaving strict mode off is useful for ordinary whitespace tolerance, but strict mode is the safer review setting for pasted keys from tickets, email, or documentation.

Security and Privacy Notes:

RSA private keys are credentials. A converted private key can grant the same access as the original wherever that key is trusted. Copying the output to the clipboard, saving a PEM file, or leaving a passphrase visible on screen can expose the secret even when the conversion itself stays local after the page loads.

Wrapper conversion is not incident response. If a private key may have been copied by the wrong person, stored in a public place, or committed to a repository, generate and deploy a new keypair. Rewrapping the same private values only changes how software reads the key.

Use encrypted PKCS#8 when the destination supports it and your passphrase process is reliable. Some automated systems still require unencrypted private PEM, which shifts the protection burden to filesystem permissions, secret managers, audit trails, and rotation schedules.

Worked Examples:

Legacy private key to PKCS#8. A deployment script has an RSA PRIVATE KEY block, but a new service asks for PRIVATE KEY. After the details confirm a private RSA key, choosing PKCS#8 private changes the wrapper while the modulus digest and SPKI pin continue to identify the same public key.

Public key for a generic importer. A legacy system provides RSA PUBLIC KEY, while a certificate tool expects PUBLIC KEY. Choosing SPKI public wraps the public modulus and exponent in SubjectPublicKeyInfo without requiring private material.

Encrypted private input. An ENCRYPTED PRIVATE KEY block cannot be inspected until the passphrase opens it. Once decoded, the details and readiness rows show which private and public targets can be generated.

Public input with a private target. A PUBLIC KEY block can become another public wrapper, but private targets remain unavailable. The private exponent and prime factors are not present in the public structure.

FAQ:

Does changing an RSA wrapper change the keypair?

No, not when the decoded RSA values are rewrapped correctly. The public identity should still match through the modulus digest or SPKI pin.

Can a public key be converted into a private key?

No. Public PEM contains only public RSA values. The private exponent and prime factors are absent, so a private-key wrapper cannot be produced from public input.

Why do two files for the same key look different?

They may use different boundary labels, encrypted versus unencrypted containers, or different base64 line widths. Compare parsed identity fields instead of the visible PEM text alone.

Does this handle OpenSSH private keys, PPK files, JWK, DER, or PKCS#12?

No. The accepted input is RSA PEM with PRIVATE KEY, RSA PRIVATE KEY, ENCRYPTED PRIVATE KEY, PUBLIC KEY, or RSA PUBLIC KEY boundaries. Other containers need their own conversion path first.

Should the converted private output always be encrypted?

Use encrypted PKCS#8 when the receiving system supports it and your team can store the passphrase safely. If an automated system requires unencrypted PEM, use secret storage and restrictive permissions.

Glossary:

ASN.1
A notation for structured data used by many cryptographic formats before they are encoded as bytes.
DER
A deterministic binary encoding for ASN.1 data. PEM commonly carries DER bytes as base64 text.
Modulus
The RSA public number n. Its bit length is commonly called the RSA key size.
Public exponent
The RSA public number e, often shown as 65537.
PKCS#1
The RSA-specific standard family for RSA public and private key structures.
PKCS#8
A generic private-key container that can carry RSA and other private-key algorithms.
SubjectPublicKeyInfo
The generic public-key structure used by X.509 certificates and the PUBLIC KEY PEM label.
SPKI pin
A SHA-256 digest of the DER-encoded SubjectPublicKeyInfo structure, usually displayed in base64.