Add digital signature

This commit is contained in:
Miloslav Ciz 2022-01-14 22:22:28 -06:00
parent 4e4eaff6bc
commit cf9b87dc08
2 changed files with 33 additions and 0 deletions

9
digital_signature.md Normal file
View file

@ -0,0 +1,9 @@
# Digital Signature
Digital signature is a method of mathematically (with [cryptographical](cryptography.md) algorithms) proving that, with a high probability, a digital message or document has been produced by a specific sender, i.e. it is something aka traditional signature which gives a "proof" that something has been written by a specific person.
It works on the basis of [asymmetric cryptography](asymmetric_cryptography.md): the signature of a message is a pair of a public key and a number (the signature) which can only have been produced by the owner of the private key associated with the public key. This signature is dependent on the message data itself, i.e. if the message is modified, the signature will no longer be valid, preventing anyone who doesn't posses the private key from modifying the message. The signature number can for example be a [hash](hash.md) of the message decoded with the private key -- anyone can check that the signature encoded with the public key gives the document hash, proving that whoever computed the signature number must have possessed the private key.
Signatures can be computed e.g. with the [RSA](rsa.md) algorithm.
The nice thing here is that **[anonymity](anonymity.md) can be kept with digital signatures**; no private information such as the signer's real name is required to be revealed, only his public key. Someone may ask why we then even sign documents if we don't know by whom it is signed lol? But of course the answer is obvious: many times we don't need to know the identity of the signer, we just need to know that different messages have all been written by the same person, and this is what a digital signature can ensure. And of course, if we want, a public key can have a real identity assigned if desirable, it's just that it's not required.

24
rsa.md Normal file
View file

@ -0,0 +1,24 @@
# RSA
TODO
generating keys:
1. *p := large random prime*
2. *q := large random prime*
3. *n := p * q*
4. *f := (p - 1) * (q - 1)* (this step may differ in other versions)
5. *e := 65537* (most common, other constants exist)
6. *d := solve for x: x * e = 1 mod f*
7. *public key := (n,e)*
8. *private key := d*
message encryption:
1. *m := message encoded as a number < n*
2. *encrypted := m^e mod n*
message decryption:
1. *m := encrypted^d mod n*
2. *decrypted := decode message from number m*