This is another cryptography related concept that we need to befriend along with hash functions to dive into crypto-currencies later in the book. A digital signature is meant to be exactly what it is named. It should serve the same purpose as a normal signature does, but it must be digital, that is it can be read, written and verified digitally. There are essentially two properties that are required in this context.
- If we are talking about X's signature, then
only X should be able to create the signature, but looking at X's signature,
anyone should be able to easily verify that it is the signature of X.
- A signature must be tied to the document being signed by X, so that signing a document cannot be misused to mark X's endorsement for some other document.
(See how these two properties are very much required in the analog world as well, the ink signatures we have on paper, but it is extremely hard to assure these properties in the real world). Luckily as it turns out, meeting these requirements is relatively easy in the digital universe. Cryptography makes it beautifully possible using a pair of keys.
Let's start with a
pair of keys (think of them as some values for now). Let's assume that we have a function that creates a unique pair of keys every time we call it. This is the
CreateKeyPair(size) function. It takes the size as input, and generates a pair of keys
sk (secret/private key) and
pk (public key).