How Digital Signatures Work
Key Pair Generation
A key pair (a public key and a private key) is generated using cryptographic algorithms such as RSA or ECC (Elliptic Curve Cryptography). The private key is kept secret by the owner, while the public key is distributed to others.
Signing Process
Hashing : The sender creates a hash of the message. A hash function generates a fixed-size string of characters from the input data, which is unique to the data (like a fingerprint).
Encryption : The sender then encrypts this hash with their private key. This encrypted hash, along with the hash algorithm, forms the digital signature.
Verification Process
Decryption : The recipient decrypts the digital signature using the sender's public key to retrieve the hash value.
Hash Comparison : The recipient also generates a hash of the received message using the same hash algorithm used by the sender. If the decrypted hash matches the hash of the received message, the signature is valid, confirming that the message has not been altered and is from the legitimate sender.