7 ms·
Why exactly would you do any of this instead of a) just having a field of 32 bytes in the wire protocol (if binary) b) just turning it into a hex string (if t
by formerly_proven 6y ago
Why exactly would you do any of this instead of
a) just having a field of 32 bytes in the wire protocol (if binary)
b) just turning it into a hex string (if text is needed) or base64/85 if you don't want hex for some reason
- viraptor 6y ago> Why exactly would you do any of this Because it's your first adventure in the land of crypto and you have no idea how to do things, which parts you need to learn about and which are not required. It seems trivial for me now, but there was a time I would end up on a similar journey. I don't know of a source which would do a quick walk through all of these levels. And if there is one, I don't know how you'd find it without knowing the right keywords. (Now I'm tempted to write up some "crypto and certificates and public keys and other things explained quickly and without depth so you can ask better questions next" post)
- formerly_proven 6y agoFair enough, if you don't know "the customs" it's probably very easy to end up looking for "public key formats" and fall into the PKIX/X.509/ASN.1 rabbit hole.
- cordite 6y agoIt’s actually quite an exciting rabbit hole to explore with not many useful Google search results to educate on. Opinions are my own :)
- alfiedotwtf 6y agoRabbit hole is a polite way to put it. Antiquated pile of shit is getting closer to the truth
- Aachen 6y agoNot the person you replied to, but > Because it's your first adventure in the land of crypto and you have no idea how to do things is rather presumptuous. I do actually know how to do crypto things (I review and test such things for a living) and after reading their comment and skimming the post I'm left wondering the exact same thing.
- viraptor 6y agoYou misunderstood the answer. It's "you" as in: why would person X do this - because person X is a beginner in this area. (Like the author)
- Aachen 6y agoI figured as much, and by the way English has the word "one" for that (e.g. one could go for a walk), but regardless you're replying to someone, quoting them even, and calling it ignorant. You can wave it away as being written in general, but either way you're including the person you replied to in the group that you call ignorant.
- b0afc375b5 6y agoI agree 'one' might have been the better word, but I understood what the 'you' meant immediately, as a third person reference, not directed to anyone specific. English is weird that way.
- Aachen 6y agoI mean, so did I? See the first two words of the comment
- b0afc375b5 6y agoYou say you understand, but the second part of your statement indicates that you don't. What I'm puzzled by is, why did you feel the need to suggest that the comment in question can be considered an attack on someone, when it is clear (to the both of us, as you point out), that it isn't so? Edit: I say this because I always think about this guideline before I comment: > Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize. Assume good faith.
- artificialLimbs 6y agoThat would be the post I have been searching for the last 2 years of my life. I have to budget my time very strictly, and finding out how to learn about security is obscure at best.
- Aachen 6y agoIndeed, and it's not being helped by people claiming we're all going to do it wrong anyway so they won't tell us just in case we'll roll our own crypto with it. At least that was my experience getting into the topic before I knew what to even search for.
- est31 6y agoASN.1 and stuff were developed with crypto agility in mind [0]. Right now ed25519 is enough but maybe in the future we might be using quantum ready algorithms instead. Your 32 bytes in the wire protocol might not be enough for that. And how would it know when given a hex string whether it's an ed25519 key or a post quantum crypto key? If it's ASN.1 encoded, you can just check the OIDs. Of course it all depends on your domain. Maybe you build an app that won't be used any more in 3 years. But if you feel like your protocol will be implemented by many vendors and you might want to allow vendors to use multiple algorithms so that support for alternatives is already present if a vulnerability is found in algorithm, it's better to have self describing key data instead. [0]: https://en.wikipedia.org/wiki/Cryptographic_agility https://en.wikipedia.org/wiki/Cryptographic_agility
- CameronNemo 6y agoWell if you were using something like protobuf/gRPC, you could evolve the API.
- yuliyp 6y agoOr you can encapsulate it so that the API layer doesn't need to worry about the crypto format.
- timbray 6y agoWell, because it's not just Go. I want other languages to be able to use these. Other languages maybe don't regard ed25519 as a byte array. So I could tell the world "I invented a way to serialize keys, please use it" or I could say "I used the standard ASN.1/foobar to serialize them so you can use standard libraries to deserialize them."
- FiloSottile 6y agoIf there's a language that doesn't take 32 byte strings and give you an Ed25519 public key or private key, please do point me to it and I will message the maintainer. We're basically all on the same Slack :)
- jetzzz 6y agoYou are not inventing new way of serializing them, byte arrays are what ed25519 keys are. In fact, by using ASN.1 you are making it more complicated to use and increase attack surface as one now needs an ASN.1 library in addition to an ed25519 library.