# Public Key Encryption and Digital Signatures

## How does Sam authenticate his identity using Public Key encryption?

Which key does Sam use to encrypt the HMAC code?

## How does Joe verify Sam's identity in this scenario?

Which key does Joe use to decrypt the encrypted HMAC code that he receives?

## Answer:

To authenticate his identity, Sam uses his own private key (Sam-Priv) to encrypt the HMAC code. Joe, the recipient, then uses Sam's public key (Sam-Pub) to decrypt the HMAC code and verify Sam's identity.

## Explanation:

In Public Key encryption, when Sam is putting digital signatures on his messages to prove his identity, he would use his own private key, i.e., Sam-Priv, to encrypt the HMAC code. This is because the private key is kept secret and only known to Sam, thereby guaranteeing that the HMAC code was encrypted by him, validating his identity.

Now when Joe receives the messages from Sam with the encrypted HMAC, Joe would use Sam's public key, i.e., Sam-Pub, to decrypt the HMAC code. The public key of an individual can decrypt an HMAC that has been encrypted using the corresponding private key.

As Sam's public key is known to Joe, he can use it to decrypt the received HMAC code, thereby confirming Sam's digital signature and identity.