Closed glowkeeper closed 7 years ago
IPFS generates a regular RSA key pair.
The Peer ID is the hash of the public key. When peers connect to each other they exchange public keys. The communications are encrypted using those keys. You can check that the peer ID matches the hash of the public key provided by a peer to ensure you are talking to the right person.
IPFS stores the [private] RSA key in the configuration. No passphrase. There is no self-signed certificate involved in the whole process.
@hsanjuan thanks! Where is that [private] RSA key stored?
And how does the RSA key generation work, exactly? Does it just pick a modulus and exponent at random?
@glowkeeper stored in ~/.ipfs/config
by default.
It uses https://golang.org/pkg/crypto/rsa/#GenerateKey with a random source seeded with current time nanoseconds. (https://godoc.org/github.com/libp2p/go-libp2p-crypto)
with a random source seeded with current time nanoseconds.
That is not true, it uses Golang's crypto/rand
module that uses entropy sources provided by system.
@Kubuxu thanks, I should have checked before speaking
@hsanjuan, earlier you said: "You can check that the peer ID matches the hash of the public key provided by a peer to ensure you are talking to the right person." That checking is where I'd imagine a signature or some such like would come into play, but there is no signature. So how does that process work?
Forgive me for blathering on. And feel free to tell me: "go look for yourself!" and point me in the direction of the source ;)
@glowkeeper you don't need a signature because your name (peer ID) is the hash of your public key. If a node tried to use someone else identify it would not be able to provide a public key which had the same hash as the original to match the ID that it is trying to use. (I mean, it would be able to provide the original public key from the true peer, but it would not have the private key so it couldn't decode any of the data sent to it).
Other than that there is no trust-schemes or authorities like say, with web certificates.
This issue was moved to https://discuss.ipfs.io/t/how-does-node-identity-work/317
I'm trying to understand how identities work in IPFS. This question is related to https://github.com/ipfs/faq/issues/236
Anyway; I run this to initialise an IPFs repository:
The IPFS architecture specs (https://github.com/ipfs/specs/tree/master/architecture), state this:
So is this 'PKI-based identity' a self-signed certificate using the RSA keypair? How is that 2048-bit RSA keypair generated? Is there some default/automated passphrase or some such used? Forgive me if it's obvious, but I'd really appreciate a thorough explanation.