Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Security Introduction to Data Security Solutions Services

Daniel Breen
Daniel Breen
14,943 Points

How to share the Public Key (asymmetrical)

My understanding is that in order for a person/user to generate a private key, they must have the public key or some kind of administrator has to generate the private key for them.

So how does the user receive the key securely in the first place? If its sent through email and I intercept your public key, can't I just generate a private key and pretend like I'm just another user?

No, because the keys come in pairs. You won't be able to duplicate a private key from its original public key. It is impossible.

1 Answer

Steven Parker
Steven Parker
231,248 Points

The encrypted message is generated using the sender's private key and the intended recipient's public key. At the other end, the decryption requires just the opposite: the sender's public key and the recipient's private key.

Anyone intercepting the message would not have access to the recipient's private key.

And there is no mechanism that can create a private key from a public key. They are generated as a pair by a complicated process designed specifically not to be repeatable.