Gratis å bruke, uten konto

RSA-nøkkelgenerator

Opprett et offentlig og privat RSA-nøkkelpar i denne nettleseren, se SHA-256-fingeravtrykket, og krypter eller dekrypter korte meldinger lokalt.

Lokal demonstrasjon, ikke et sertifikat, en betrodd identitet, en nøkkellagringstjeneste eller en sikkerhetsrevisjon. Alle som har den private nøkkelen, kan dekryptere meldinger. Oppbevar en sikker sikkerhetskopi; hvis du mister nøkkelen, kan chiffertekst bli umulig å gjenopprette.

Offentlig nøkkel (SPKI PEM)

Privat nøkkel (PKCS8 PEM)

Den private nøkkelen vises slik at du kan lagre den. Ikke del den eller lim den inn på et nettsted du ikke stoler på.

RSA-OAEP med SHA-256 krypterer bare korte meldinger: 190 UTF-8-byte med 2048-bit nøkkel eller 318 byte med 3072-bit nøkkel. Bruk hybridkryptering for større data.

Hvordan oppretter jeg et RSA-nøkkelpar?

Velg 2048 eller 3072 bit og generer et nøkkelpar. Den offentlige nøkkelen bruker SPKI PEM, og den private nøkkelen bruker PKCS8 PEM. Oppbevar den private nøkkelen trygt; den lastes ikke opp eller sikkerhetskopieres.

Veiledning

Slik bruker du RSA-nøkkelgenerator

The RSA Key Generator makes an RSA public and private key pair in your browser with the Web Crypto API. You choose a 2048-bit or 3072-bit key, copy the two PEM texts and a SHA-256 fingerprint, and can try encrypting and decrypting one short message. It is a tool for learning and testing. It is not a certificate, a key vault, a signing tool or a security review.

Slik gjør du

  1. Pick the key size, 2048 bits or 3072 bits. Changing the size wipes any key, fingerprint and message that were already on the page.
  2. Press Generate key pair and wait a moment. The page then fills in the public key (SPKI PEM), the private key (PKCS8 PEM) and the SHA-256 fingerprint.
  3. Copy the private key into a password manager or another place you control. The page does not save it, so a refresh or a closed tab loses it for good.
  4. To test the pair, type a short message, press Encrypt message, then press Decrypt message to get the same text back. Clear all empties every box.

Eksempler

What a 2048-bit pair looks like

Du skriver inn
nøkkelstørrelse
2048
Du får
offentlig nøkkel
PEM block starting with BEGIN PUBLIC KEY, 294 bytes of key data, 9 lines
privat nøkkel
PEM block starting with BEGIN PRIVATE KEY, about 1,200 bytes of key data
fingeravtrykk
SHA-256: followed by 44 Base64 characters (52 characters in all)
maksimal meldingsstørrelse i byte
190

Each run gives a different pair, so the exact letters change. The sizes and shapes above came from a real run of the tool's code, and the private key length can vary by a few bytes.

Kjørt med verktøyets egen kode.

The message size limit counts bytes, not letters

Du skriver inn
nøkkelstørrelse
2048
meldinger
190 letters 'a'; 191 letters 'a'; 96 letters 'é'
Du får
190 tegn
accepted
191 tegn
refused: at most 190 UTF-8 bytes
96 tegn é
refused: 96 x 2 = 192 bytes

The letter é takes two bytes in UTF-8, so 96 of them are already over the limit. With a 3072-bit key the same rule allows 318 bytes. Both figures follow from RSA-OAEP with SHA-256: key bytes minus 66.

Kjørt med verktøyets egen kode.

The same message gives a new ciphertext each time

Du skriver inn
nøkkelstørrelse
2048
melding
Hello
Du får
chiffertekstlengde i Base64
344
chiffertekst i byte
256
gir to krypteringer samme tekst
nei
dekryptert tekst
Hello

OAEP padding adds random data, so two encryptions of Hello differ but both decrypt to Hello. At 3072 bits the ciphertext is 384 bytes, which is 512 Base64 characters.

Kjørt med verktøyets egen kode.

Decrypting with the wrong private key

Du skriver inn
chiffertekst fra
key pair one
brukt privatnøkkel
key pair two
Du får
resultat
an error message and no text

Only the matching private key can open the ciphertext. A different key makes the browser refuse the decryption, and the page shows an error rather than wrong text. The exact wording of the error depends on the browser.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • See how a public key, a private key and a ciphertext relate to each other, for a class or a self-study session.
  • Make a throwaway key pair for a demo, a test fixture or a code example that needs PEM text in the right format.
  • Check what SPKI and PKCS8 PEM files look like before writing code that reads them.
  • Practise comparing SHA-256 key fingerprints over a separate channel, the way people confirm a key belongs to someone.

Begrensninger

  • Only 2048-bit and 3072-bit keys can be made. The keys are set up for RSA-OAEP with SHA-256, so they encrypt and decrypt but are not made for signing.
  • Only SPKI public keys and PKCS8 private keys in PEM text are used. PKCS#1, certificates and OpenSSH formats are refused, and the private key has no passphrase.
  • A message can be at most 190 UTF-8 bytes with a 2048-bit key or 318 bytes with a 3072-bit key. This is a short-text demo, not a file encryptor.
  • Nothing is stored. The keys exist only in the open page, and a public key does not prove who owns it. A fingerprint only helps you compare keys.

Tips

  • Save the private key before you close the tab, and test that your copy decrypts a message before you rely on the pair.
  • Compare fingerprints with the other person by phone or in person, not in the same chat where the key was sent.
  • Treat keys made in a web page as practice keys. For real systems, use keys from a reviewed tool or key service and ask a security professional.

Kilder

Vanlige spørsmål

How does this tool make the keys?

It calls the browser's Web Crypto generateKey function for RSA-OAEP with SHA-256, a public exponent of 65537, and the size you pick. The keys are marked as exportable so the page can show them as PEM text. The random numbers come from the browser, not from the page's own code.

Does my private key leave my browser?

The tool's own script, in the build inspected for this card, contains no network or storage calls, and the page only shows the key in a text box. Still, a description is not proof: you can watch the Network tab in your browser's developer tools. Extensions, screen sharing and the clipboard can also expose a key.

Should I choose 2048 or 3072 bits?

NIST SP 800-57 Part 1 Revision 5, Table 2, lists 2048-bit RSA at 112 bits of security strength and 3072-bit RSA at 128 bits. A bigger key is a higher setting but is slower, and the system you plan to use may decide for you. Follow the rule of that system or your organisation, and check current NIST guidance, because the period in which 112-bit strength stays acceptable is limited.

Can I use these keys in production?

Think carefully before you do. Keys shown on a web page can be seen by extensions, shared screens and the clipboard, and this tool has no passphrase, no hardware protection and no rotation plan. For real use, make keys in a controlled place with reviewed software and ask a security professional.

Why can't RSA encrypt a large message here?

RFC 8017 limits an OAEP message to the key size in bytes minus twice the hash length minus 2. With SHA-256 that is 256 − 64 − 2 = 190 bytes for 2048 bits and 384 − 64 − 2 = 318 bytes for 3072 bits. Larger data needs hybrid encryption, which is a reviewed design and not part of this tool.

What is the fingerprint for?

It is a SHA-256 hash of the public key data, shown in Base64. Two people can read it to each other over a trusted separate channel to confirm that they hold the same public key. It is not a certificate and does not say who the owner is.

What happens if I lose the private key?

You can no longer decrypt anything that was encrypted for that key, and the page cannot recover it because it never saved a copy. Keep a backup somewhere you control before anyone encrypts data for the pair.

Hvordan oppretter jeg et RSA-nøkkelpar?

Velg 2048 eller 3072 bit og generer et nøkkelpar. Den offentlige nøkkelen bruker SPKI PEM, og den private nøkkelen bruker PKCS8 PEM. Oppbevar den private nøkkelen trygt; den lastes ikke opp eller sikkerhetskopieres.

Lastes nøklene eller meldingene mine opp?

Nei. Web Crypto oppretter og bruker nøklene i denne nettleseren. Nøklene og meldingene dine lastes ikke opp eller lagres av denne siden.

Kan RSA kryptere en stor fil?

Nei. RSA-OAEP er begrenset til korte meldinger. Dette verktøyet tillater maksimalt 190 UTF-8-byte med en 2048-bit nøkkel eller 318 byte med en 3072-bit nøkkel. Større filer krever et gjennomgått oppsett for hybridkryptering.

Er en offentlig nøkkel et sertifikat?

Nei. En SPKI-offentlig nøkkel inneholder nøkkelmateriale, men beviser ikke hvem som eier den. Et SHA-256-fingeravtrykk gjør det enklere å sammenligne nøkler via en separat, betrodd kanal.

Hva skjer hvis jeg mister den private nøkkelen?

Det kan bli umulig å dekryptere meldinger som er kryptert for denne nøkkelen. Lagre en sikkerhetskopi et sted du kontrollerer før du stoler på nøkkelparet.