Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How works Public-key cryptography on Github?

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...

like image 846
Acaz Souza Avatar asked May 05 '11 14:05

Acaz Souza


People also ask

How does public key cryptography works?

Public key cryptography enables the following: Encryption and decryption, which allow two communicating parties to disguise data that they send to each other. The sender encrypts, or scrambles, the data before sending it. The receiver decrypts, or unscrambles, the data after receiving it.

Does GitHub use encryption?

GitHub uses a libsodium sealed box to help ensure that secrets are encrypted before they reach GitHub and remain encrypted until you use them in a workflow. For secrets stored at the organization-level, you can use access policies to control which repositories can use organization secrets.

How public key cryptography is used for authentication?

The public key authentication protocol uses two keys per node, a public key for encryption and a private key for decryption. Everybody has access to the public key of a node, while the private key is secret. During authentication, random numbers are generated and exchanged, similar to the shared secret key protocol.

How are public keys distributed to clients?

In public key cryptography, the key distribution of public keys is done through public key servers. When a person creates a key-pair, they keep one key private and the other, known as the public-key, is uploaded to a server where it can be accessed by anyone to send the user a private, encrypted, message.


1 Answers

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)

  • Github sends you something random, that is encrypted with his _private_ key (Maybe its not that random, I dont know, but doesnt matter here)
  • You receive it and decrypt it with his _public_ key. If this is possible, you are sure, that you are really talking to the official github server
  • Then you send the same random stuff encrypted with your _private_ key to the github-server
  • He tries to encrypt it with your _public_ key. If this is possible and its the random stuff he has sent you before, he knows for sure, that you are you.
  • Then you send you stuff encrypted with his _public_ key. Now only the github server can decrypt. Also he will answer with messages/data encrypted with your _public_ key, because only you can decrypt it.

Even if its not completely correct, it should describe the idea.

like image 52
KingCrunch Avatar answered Oct 17 '22 08:10

KingCrunch