ArachisH / Sulakore

Habbo SDK
14 stars 4 forks source link

wip draft: HKeyExchange rewrite #34

Closed PaulusParssinen closed 3 months ago

PaulusParssinen commented 2 years ago

This is just a work-in-progress draft PR to track my slow progress to attempt making the HKeyExchange implementation more "correct". I'm really suspicious of the current implementation because it's does the PKCS 1.5 padding incorrectly and it might have been working by pure luck (lol?). This piece of the SDK should also have really good testing coverage in future 😅

Having complete amateurs writing a managed crypto implementation is terrible idea and so I added a disclaimer remark for that too. We would like to use the more "correct" RSA implementations provided by the base OS but my attempts to do that have not go well so far.

So far I've added implementation of the probabilistic Miller-robin primality test for the random prime generation and rewrited the PKCS#1 1.5 padding to use very handy RandomNumberGenerator.GetNonZeroBytes(Span<byte> data) (which might be obsoleted in near future, see https://github.com/dotnet/runtime/issues/42763)

TODO

ArachisH commented 1 year ago

Had to move the base to another branch for some spring(summer) cleaning, also what's up with that conflict?

PaulusParssinen commented 1 year ago

Not entirely sure what was up with the HKeyExchange conflict.. Will try finish this one ASAP.

PaulusParssinen commented 3 months ago

ggs, will continue on my fork.