Now that we've created a hash we can move on to the next stage.
We'll show you how to force the non repudiation of a message to do this we need a digital signature.
Let's see how it works.
The initial point is a message as you know we can compute a fixed length hash like sh or to from any
variable length message.
Once the hash has been successfully generated encrypted using asymmetrical cryptography but don't use
a public key.
Instead we'll be using a private key to encrypt the hash.
The result is a signature or a digital signature.
It's the output calculated from encrypting a hash function using a private key.
What should you do to be able to determine that a challenge has been set by a specific user you can
calculate a hash from the received message for example by using the SHC to hash function.
It's obvious now you have the hash of the message you've received.
The message was complemented with an encrypted signature the digital signature.
It was also encrypted using the sender's private key.
You can now take the sender's public key which can be accessed by everyone and decrypt the hash received
in the message.
There will always be some result.
Now you can compare the output from the public key decryption against the output you calculated if they
match.
It means that you have proof that the message has not been modified after it was sent.
And also another vital aspect has been established.
The sender is unable to dispute the claim that they had sent in the message they or someone who had
access to their private key in any other case decryption using that sender's public key would have produced
a different output.
This is exactly how the RSA signature works.
It's based on the assumption that the private key and part of the public key the value e are symmetric.
They can be used to encrypt and decrypt data the operations that are performed using the private key
and the public directly reversed.
This produces an interesting result.
Since the private key and a part of the public key can be used interchangeably to encrypt and decrypt
data.
A peculiar kind of attack can be mounted
if an attacker sends you a specially crafted message and you encrypted using your private key the message
sender will be able to sign their arbitrary message using your signature on your behalf.
There will also be able to impersonate you
before we'll show you how this attack proceeds.
A few words on what this should mean if you receive weird looking pseudo random strings.
Don't be so reckless as to instantly encrypt it using your private key.
This is the only thing you should keep in mind to prevent an attack of this type.
The attack itself works as follows.
An attacker needs to generate the message m a contract or anything else they want you to sign.
Next the attacker calculates a hash of the message.
The next step is to generate the random message x.
Then the attacker generates the message based on the expression Z times x to the power e.
Where is your public key.
The public key is by very definition freely available.
Once you have received this message your encrypted using your private key to do this.
You perform the following operation.
If you take a look at the encryption process and decompose it into factors this operation is Z to the
power of D.
Times x
the attacker needs only to divide the value that you have encrypted by x.
The random message that the attacker knows since they generated it in this way the attacker obtains
the victim's signature under the message m or practical piece of advice don't encrypt anything that
is sent to you using your private key.
They all Gama'a algorithm can also be used to create a digital signature even if the private kids in
public he's used in it are not symmetric.
They cannot be used for both operations.
The procedure looks as follows to sign some data.
You need to pick a random value k.
It has to be the coprime integer from P minus one with a part of the public key.
Calculate the equation.
R equals G to the power k mod p then sign the message hash using your private key all as integer to
hash functions.
Follow this scheme
the airport has a digital signature.
A pair of values are in S.
You can of course also verify the signature.