The public and private key pair is not used to encrypt the entire assembly. Instead, it is used to sign assembly.
Simplifying the simplification is to sign the file - for example, an assembly - you take the hash of the file, and then end this hash with your private key. Someone using the file verifies your signature by creating a hash of the file itself and then decrypting your encrypted hash with your public key, and confirming these two hashes is the same. This proves two things:
- The assembly comes from the one who claims to be because of you - since it was created with your private key.
- The assembly was not changed by someone else, because the hash that you made when you released the assembly is the same as the current one. No one can change the signed assembly, as they will also have to make the appropriate changes to the encrypted hash that requires your private key.
For more information on digital signatures, see this Wikipedia article .
The great thing about the public and private key parses is that they work anyway. Thus, something encrypted with your private key can only be decrypted with your public key, but something encrypted with your public key can be decrypted with your private key. The latter use means that if someone wants to send something to you and only you, then you can encrypt it with your freely available public key, but they know that only you with your private key can decrypt it.
Since the keys work only in pairs, and the encryption is asymmetric - someone else canβt just cancel the public key encryption that he does to receive a message for you.
source share