[WIP] Remove dynamic constants from cryptography products#2556
[WIP] Remove dynamic constants from cryptography products#2556vepkenez wants to merge 4 commits intonucypher:mainfrom
Conversation
|
Thanks for doing this. I guess these constants should have never live the runtime environment and be serialized anywhere. IMHO, if there's a need to serialize a constant, then this is a hint that you should not use Constant Sorrow for it. |
| # SECP256K1 | ||
| CAPSULE_LENGTH = 98 | ||
| PUBLIC_KEY_LENGTH = 33 | ||
|
|
There was a problem hiding this comment.
@KPrasch @cygnusv @derekpierre @fjarri @jMyles
These could be anything.
Currently I made them exactly what Constant Sorrow was outputting so they don't break compatibility with existing bytestrings, but now is the time to break that in favor of a better future.
So what should we make them?
They could be like:
DO_NOT_SIGN = b'DO_NOT_SIGN'
any reason not to do that?
There was a problem hiding this comment.
Why not just make them sequential bytes? \x00, \x01 and so on?
There was a problem hiding this comment.
That would definitely make cross platform implementing easiest
|
One more consideration before I finish this. Our encryption looks like this: We are adding this "signature header" to the actual plaintext. But why are we adding this stuff to the plaintext at all? Isn't it kind of a hack? I as an implementer might prefer my own signing mechanics on the the payload anyway and hand the data over to Enrico already signed. Any support for removing signatures entirely? |
|
I'd love to see this PR finished, it's a nice prerequisite to our future plans with entity serialization. |
|
Closing this PR for due to staleness. Leaving #1484 open. |
Type of PR:
Required reviews:
What this does:
Constant Sorrow constants are not really constant in the sense that bytestrings produced by our code may outlive some of the mechanisms by which Constant Sorrow produces the literals for them whether due to encoding, hashlib changes etc. This PR makes them truly static and constant.
It also makes parallel implementation of them in other languages easier in that it is now a copy and paste of some characters instead of a re-implementation of Constant Sorrow magic, or maybe even opens the possibility for pulling from definitions for these bytestrings from a single repo that is accessible to all language implementations.
Issues fixed/closed: