w3c / vc-di-ecdsa

Data Integrity specification for ECDSA using NIST-compliant curves
https://w3c.github.io/vc-di-ecdsa/
Other
9 stars 9 forks source link

Fix encoding of P-384 public key #2

Closed peacekeeper closed 2 years ago

peacekeeper commented 2 years ago

I think this should be the correct multicodec encoding of a P-384 key...

peacekeeper commented 2 years ago

I'm pretty sure my change is correct. Your base58-encoded value is in hex:

120001d8ebdd36bddf1615b5aa10044b79cf188586d905e0e45611c8adc62de3e93ffb53b52494eacfb9ea93dc9229a9b7c31294f7834881e7be604d54e8ea64752575

And my value is in hex:

8124d8ebdd36bddf1615b5aa10044b79cf188586d905e0e45611c8adc62de3e93ffb53b52494eacfb9ea93dc9229a9b7c31294f7834881e7be604d54e8ea64752575

So your prefix before the actual key bytes is 120001, and my prefix is 8124. According to the multicodec table, the code for "p384-pub" is 0x1201, but I think that is encoded as a varint and therefore becomes 0x8124.

Maybe @clehner or @OR13 or someone else could also verify.

OR13 commented 2 years ago

yes, our implementation could be wrong... but we currently have these formats:

https://did.key.transmute.industries/did:key:zDnaevgFAhv9AgwgF7LUmEHzKSPhmXiNLUShrAiSyHJtM945k

https://did.key.transmute.industries/did:key:z82LknFT9NnExdcxpFoMARYgBLP5vwniv75zWxQHoss3Md1xLj57YujHzKSxgYWMmDi92MH

I believe we cross checked with with Secure Key when last we updated the did key test vectors.

cc @troyronda

peacekeeper commented 2 years ago

https://did.key.transmute.industries/did:key:z82LknFT9NnExdcxpFoMARYgBLP5vwniv75zWxQHoss3Md1xLj57YujHzKSxgYWMmDi92MH

Yes this also seems to have the correct 0x8124 multicodec varint value. I think this confirms that my PR here is correct.