Reputation: 8641
In Public-key cryptography is generated a pair of key, one private and one public, the public I put in the Github.
The Private-key decrypts the data and the Public-key encrypts the data. This means when I sent data to github this data is not encrypted because only Private-key decrypts the data?
Update:
Thanks guys, i'm understanding now.
I'm was thinking my data is encypted with that way in github when I send push/pulls. This case is used for login/verification/signing. That's all completely different from the encrypted transmission stream that the SSH connection sets up to send my datas.
Thanks everyone for your responses...
Upvotes: 8
Views: 2110
Reputation: 351
Data encrypted with a private key can be decrypted using the public key (and vice versa)
PKI is based upon two keys (public and private) Data can be securely encrypted using either the public or private keys Data can only be decrypted when using the opposite key to that which encrypted the data
Note: A public key can be generated from a private key (not the other way around) source: https://github.com/topics/public-private-key
Upvotes: 0
Reputation: 132031
Not wrong at all, but wrong. (a) The private key decrypts the data encrypted by the public key and (b) the public key decrypts the data encrypted by the private key.
(a): Everybody can encrypt something, but only the owner of the private key can decrypt it.
(b): The owner "encrypt" something with his private key and everybody can decrypt it, what ensures, the it were really the owner, that encrypts the data and not somebody else.
git(hub) makes use of the second scenario: If you push something, it its signed with your private key. The receiver now validates the signature againts the public key it knows from you. If its match, everything is fine.
Update: A (maybe too) simplified description on what happens (when using github with ssh)
Even if its not completely correct, it should describe the idea.
Upvotes: 10
Reputation: 139890
A gross simplification is that when you try to push something, GitHub will send you a challenge by encrypting some random stuff with your public key and seeing if you can decrypt it or not, which you will only be able to do if you have the private key.
Upvotes: 2