-1
$\begingroup$

I'm new to cryptography and still trying to understand the way an asymmetric cryptography works. Here's what I learned yet -

If Bob wants to send Alice a message, Bob will encrypt the message with his PUBLIC key, and that key will be made available to everyone. But decryption can only be done using the PRIVATE key.

So if Alice has the PRIVATE key, she will be able to use the combination of Public + Private to decrypt the message.

Here are the questions:

  1. Where does the private key generate from? (If I encrypt a message using a public key suppose 'abc', will the application generate a private key that goes along with it, suppose '123'? I don't exactly understand how the receiver will get the private key.)

  2. Asymmetric is said to be more secure because there are two keys, but at the end, if the public key is in literal sense, public, then it does not exactly make any difference, does it?)

  3. Is there a relation between the public and private key? Because if the encryption is done using the public key, then how does the private key hold the power to decrypt the message?

A small example of how both the keys work would be appreciated.

I tried finding the answers, but none of the explanations seem to describe this confusion in detail.

$\endgroup$
2
$\begingroup$

You've got it a bit mixed up: if Bob wants to send Alice a message, Bob will encrypt the message using Alice's public key, not his own. This means that only Alice can decrypt the message, using her own private key.

  1. Where does the private key generate from? (If I encrypt a message using a public key suppose 'abc', will the application generate a private key that goes along with it, suppose '123'? I don't exactly understand how the receiver will get the private key.)

Your confusion here is likely due to the mixup above. The receiver already owns their own private key. A public and private key are mathematically linked, and generated at the same time. So Alice generates a keypair, and sends the public key to Bob. Bob can use Alice's public key to encrypt his message to Alice.

  1. Asymmetric is said to be more secure because there are two keys, but at the end, if the public key is in literal sense, public, then it does not exactly make any difference, does it?)

Who says this? The security depends on the algorithm, application, and context. Comparing asymmetric and symmetric crypto like this is a bit like comparing apples to oranges, where some of the pieces of fruit are big and ripe, while others are a bit rotten or dried out.

  1. Is there a relation between the public and private key? Because if the encryption is done using the public key, then how does the private key hold the power to decrypt the message?

Yes, there is a mathematical relation between the two keys. See the concept of a trapdoor function.

As an example, you can take a look at a simplified form of RSA. You can find lots of explanations on the internet. I like this one, for example (edit: the javascript appears to be broken but you can work through the example on paper).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.