RSA and SM2 encryption and signatures
Encrypt, decrypt, sign or verify text with an RSA key (PEM: PKCS #1, PKCS #8, public key or certificate) or an SM2 key (hex or PEM). Keys stay in the browser and are never saved with workflows.
Process locally
Files stay in this browser session. Closing or clearing releases them.
Add text
Type or paste the text to process
Adjust settings
Optional: Algorithm, Operation, RSA encryption padding and more
Run
Processes in this browser; cancel at any time
About this tool
Encrypt, decrypt, sign or verify text with RSA or SM2 keys. Use it to test an API that expects a password encrypted with its RSA public key, to check a signature from a payment or login service, or to make sure an SM2 key pair from another system works before you rely on it.
RSA keys can be PEM (PKCS #1, PKCS #8, public key or certificate) or bare Base64 DER; SM2 keys can be hex or PEM. Password-protected private keys are not supported. RSA offers OAEP with SHA-256 or SHA-1 and PKCS #1 v1.5 padding, and RS256, PS256 or PKCS #1 v1.5 with SHA-1 signatures. Text and keys stay in your browser and are not uploaded, and the key is never saved with workflows.
How to use it
- Put the text in “Text” and the key in “Key (not saved with workflows)”: a public key to encrypt or verify, a private key to decrypt or sign. Use example loads a 2048-bit RSA public key.
- Choose the “Algorithm” and the “Operation”.
- For RSA, pick the “RSA encryption padding” or the “RSA signature scheme”; for SM2, the “SM2 ciphertext order”. To verify, paste the signature into “Signature to verify”.
- Set the “Ciphertext and signature format” to Base64 or Hex, select Run, then preview and download the result.
Formats and limits
- Input
- Text
- Output
- Plain text
- Size limit
- 1 MB
- Settings
- Algorithm (RSA, SM2); Operation (Encrypt, Decrypt, Sign, Verify); RSA encryption padding (OAEP with SHA-256, OAEP with SHA-1, PKCS #1 v1.5); RSA signature scheme (PKCS #1 v1.5 with SHA-256, PSS with SHA-256, PKCS #1 v1.5 with SHA-1); SM2 ciphertext order (C1C3C2, C1C2C3); Signature to verify; Ciphertext and signature format (Base64, Hex)
- Privacy
- Text and keys stay in this browser session and are not uploaded. Keys are an input, so they are never saved with workflows or recipes.
- Price
- Free, no sign-up
Common questions
How long can the text be?
RSA encrypts a single block, so the limit depends on the key and the padding: with a 2048-bit key, OAEP with SHA-256 takes up to 190 bytes, OAEP with SHA-1 up to 214 and PKCS #1 v1.5 up to 245. Text counts as UTF-8, where a Chinese character is 3 bytes, and longer text is rejected rather than split.
Why is the ciphertext different every time?
RSA padding and SM2 encryption both add fresh random data each time, so the same text and key give a new ciphertext on every run. Each of them decrypts to the same text.
Why does decryption fail with the right key?
The padding must match the one used to encrypt: OAEP with SHA-256, OAEP with SHA-1 and PKCS #1 v1.5 cannot be mixed, and OAEP here uses the chosen hash for MGF1 as well, with an empty label. Also check that the “Ciphertext and signature format” matches the ciphertext, Base64 or hex.
Which SM2 ciphertext order should I choose?
Choose the order the other side uses: “C1C3C2 (GM/T 0003)” is the current standard and “C1C2C3 (older)” the earlier one. Encrypted output starts with the 04 point marker, and decryption accepts ciphertext with or without it.
What signature format does SM2 use?
Signing hashes the text with SM3 using the default user ID 1234567812345678 and outputs a DER-encoded signature; verification also accepts the 64-byte r‖s form. SM2 encryption and verification need the public key itself, while RSA can take the public half from a private key.
Related tools
Symmetric encryption (AES, SM4, DES)
Encrypt or decrypt text with AES (CBC, ECB, CTR, CFB, OFB or GCM), SM4, DES, Triple DES, Blowfish, RC2, RC5, RC6, RC4, Rabbit or XOR. The key is a separate input and is never saved with workflows.
Key pair generator
Generate RSA, ECDSA (P-256, P-384, P-521), Ed25519 or SM2 key pairs as PEM in PKCS #8 or traditional form, for JWT, TLS or encryption tests.
HMAC
HMAC of text with a secret key using MD5, SHA-1, SHA-2, SHA-3 or SM3. The key is a separate input and is never saved with workflows.
JWT sign
Sign a JSON payload as a JWT with HS, RS, PS, ES or EdDSA algorithms, optionally adding issue and expiry times. Secrets and private keys are a separate input and are never saved with workflows.
JWT verify
Check a JWT’s signature with a secret, public key, certificate or JWK, and optionally its expiry and start times. Unsigned tokens and HMAC tokens checked against a public key are rejected.
Caesar cipher and Morse code
Encrypt or decrypt with the Caesar cipher (any shift), ROT13, ROT47 or Atbash, or encode and decode international Morse code.