How to sign a file or message digitally
A signature answers a question encryption does not: who produced this, and has it changed since?
Encryption and signing solve opposite problems and people routinely confuse them. Encryption makes something unreadable to everyone without the key. Signing leaves it perfectly readable and attaches proof of who produced it — and proof that not one byte has changed since.
Step-by-step: signing
- Have a key pair. If you do not, generate one first.
- Load your private key. It stays in the page and is never sent.
- Choose what to sign — text, or a file.
- Sign, and publish the signature alongside the thing it signs.
Step-by-step: verifying
- Load the signer's public key.
- Add the file or text, and the signature.
- Read the verdict. Valid means this exact content was signed by the holder of the private key matching that public key.
What a valid signature does and does not tell you
It tells you the content is unchanged and that whoever holds that private key signed it. That is a strong statement, and it is narrower than people assume.
It does not tell you the key belongs to the person you think. Anyone can generate a key pair and put any name on it. A signature is only as meaningful as your reason for believing the public key is theirs — which comes from somewhere else entirely: you were handed it in person, it is published somewhere you already trust, or a certificate authority vouches for it.
Which algorithm
- Ed25519 — modern, fast, small signatures, no parameters to get wrong. Prefer it where both sides support it.
- ECDSA on P-256 — very widely supported, the usual choice for interoperability.
- RSA — older, larger, still ubiquitous. Use it when the other side requires it.
Frequently asked questions
Does my private key leave the page?
No. It is used in your browser and never transmitted. Nothing on the page is permitted to send a key anywhere.
What is the difference between signing and encrypting?
Signing proves origin and integrity while leaving the content readable. Encrypting hides the content. They are independent — you can do either, both, or neither.
The signature is valid but I still do not trust the file. Am I missing something?
No, you are reasoning correctly. Validity only ties the content to a key. Whether that key belongs to someone you trust is a separate question the mathematics cannot answer.
Open digital signatures →