Security · 58 tools · nothing uploads

JWK ↔ PEM

Convert an RSA or EC key between JWK (JSON) and PEM (SPKI/PKCS8), via crypto.subtle import/export. Ed25519/OKP keys are not supported. On your device.

Input

Options

JWK to PEM converts an RSA or EC key in either direction, defaulting to pem-to-jwk, through crypto.subtle import and export. The JSON arrives with the source PEM label appended on a trailing comment line that begins with two slashes. A kty of OKP is refused: WebCrypto handling of Ed25519 and X25519 differs between runtimes.

Questions

Which keys can it convert?

RSA keys, and EC keys on P-256, P-384 or P-521. Both directions: pem-to-jwk, which is the default mode, and jwk-to-pem. Public and private keys both work; the direction and the key type are detected from the structure rather than from what the file is called.

Why will it not take my Ed25519 key?

It refuses on purpose, with a message that kty "OKP" is not supported because WebCrypto support for Ed25519 and X25519 is inconsistent across runtimes. Getting that silently wrong would be worse than saying no, so it says no. An unknown EC curve is refused the same way, naming P-256, P-384 and P-521 as the ones handled.

What PEM does jwk-to-pem produce?

A SPKI block labelled PUBLIC KEY for a public key, and a PKCS8 block labelled PRIVATE KEY when the JWK has a private component. The choice follows the key itself, so a JWK carrying a d value comes out as a private key PEM.

Why is there a comment line at the end of my JWK?

Because pem-to-jwk appends the source PEM label after the JSON, on a line starting with two slashes. It records what your PEM was labelled. That makes the output not strictly valid JSON, so delete that line before feeding the result to a parser.

Is my private key safe here?

It never leaves the tab. Conversion goes through crypto.subtle import and export in a Web Worker, with nothing uploaded and nothing stored. The tool imports RSA as RSASSA-PKCS1-v1_5 with SHA-256 and EC as ECDSA purely as a way to reach the raw key components, which are the same regardless of that choice.

Related Security tools

n→nX.509 certificate parserDecode a PEM or DER X.509 certificate into subject/issuer/validity/public key/extensions, parsing every certificate in a multi-cert PEM chain instead of only the first. Reports what each certificate says about itself. No chain building, no revocation check, no clock: it does not tell you whether to trust it.Runs on each file you dropn→nCSR parserDecode a PEM or DER PKCS#10 certificate signing request into subject, public key and requested extensions (including subjectAltName, when present in an extensionRequest attribute). Reports the request, not a decision about whether it should be signed.Runs on each file you dropn→nCRL parserDecode a PEM or DER Certificate Revocation List into issuer, update times, and each revoked serial with its revocation date/reason. Reports what the CRL states, not whether it is current, or whether a given certificate is on it if you have not checked.Runs on each file you dropn→nPEM ↔ HexConvert a PEM block to the raw hex of its DER payload, or wrap hex bytes back into PEM armor. On your device.Runs on each file you dropn→nPublic key from cert / private keyExtract the public key from an X.509 certificate (always available; it is right there in the cert), or from an RSA/EC private key. RSA is always derivable (n/e are part of the private key itself); EC only when the key embeds its public point (SEC1's optional field; usually present, not guaranteed). This tool does not do elliptic-curve scalar multiplication to compute a missing one.Runs on each file you dropn→nCertificate chain validatorCheck that each certificate in a PEM chain was signed by the next one, with a valid signature, a current validity window, and CA flags that line up.Runs on each file you dropn→nPEM bundle splitSplit a PEM bundle, such as a certificate chain, into one file per block.Runs on each file you dropn→nSPKI pin (HPKP-style)Compute the RFC 7469 pin-sha256 of a certificate or public key's SubjectPublicKeyInfo, for HTTP Public Key Pinning or certificate pinning.Runs on each file you drop