Rivest-Shamir-Adleman (RSA)
In the RSA approach, the message that needs to be signed is first fed into a hash function that generates a secure hash code of fixed length. The sender’s private key is then used to encrypt the hash code which makes it signature. The next step involves sending both the signature and the message to the intended receiver. For validation purposes, after receiving the message, the recipient first computes its hash-code. The sender’s public key is applied by recipient to decrypt this already encrypted signature. In case if decrypted signature corresponds to recipient-produced hashcode, that means that signature would be considered as valid. Since only the sender has access to the private key, only they could have produced a valid signature.
You can refer the below diagram for RSA, here,
- M = Message or Plaintext
- H = Hash Function
- || = bundle the plantext and hash function (hash digest)
- E = Encryption Algorithm
- D = Decryption Algorithm
- PUa = Public key of sender
- PRa = Private key of sender
Digital Signature Algorithm (DSA)
A Digital Signature is a verification method made by the recipient to ensure the message was sent from the authenticated identity. When a customer signs a check, the bank must verify that he issued that specific check. In this case, a signature on a document acts as a sign of authentication and verifies that the document is authentic.
Suppose we have:
- Alice is the entity that sends a message or initiates communication.
- Bob represents the recipient or receiver of the message.
- Eve represents an eavesdropper or adversary who may attempt to intercept or tamper with the communication.
In Public Key cryptography (also known as Asymmetric cryptography), the communication process is as follows:
- Alice encrypts the message using Bob’s public key.
- The encrypted message reaches Bob.
- Bob decrypts the message sent by Alice using his private key.
Now, suppose when Alice sends a message to Bob, then Bob will check if the sender is authentic; to ensure that it was Alice who sent the message, not Eve. For this, Bob can ask Alice to sign the message electronically. So we can say that an electronic signature can prove that Alice is authentic and is the one sending the message. We called this type of signature a digital signature.