libp2p / specs

Technical specifications for the libp2p networking stack
https://libp2p.io
1.56k stars 273 forks source link

Define precisely how to marshal SubjectPublicKeyInfo structure in tls.md #358

Closed kpp closed 3 years ago

kpp commented 3 years ago

This is a clarification how to marshal SubjectPublicKeyInfo according to the go implementation (https://github.com/libp2p/go-libp2p-tls/blob/7530faa07acbfc0aa918c072c2cb35d3c8d5d859/crypto.go#L143 and https://pkg.go.dev/crypto/x509#MarshalPKIXPublicKey).

marten-seemann commented 3 years ago

All that we do is marshal the public key: https://github.com/libp2p/go-libp2p-tls/blob/7530faa07acbfc0aa918c072c2cb35d3c8d5d859/crypto.go#L167-L174 I'm not sure if we need to say anything more than https://pkg.go.dev/crypto/x509#MarshalPKIXPublicKey says, as this seems to be the standard way of marshaling the key. I find spelling it out explicitly, as suggested in this PR, confusing, as it suggests that we're doing something non-standard here.

kpp commented 3 years ago

@marten-seemann Would it be better if I replace that statement with: "The public key is encoded as a SubjectPublicKeyInfo structure as described in RFC 5280, Section 4.1:"?

marten-seemann commented 3 years ago

Would it be better if I replace that statement with: "The public key is encoded as a SubjectPublicKeyInfo structure as described in RFC 5280, Section 4.1:"?

Yes, I think referencing the RFC makes a lot of sense here.

kpp commented 3 years ago

Done. Sorry for the delay.

mxinden commented 3 years ago

Friendly ping @marten-seemann.