Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downstream library usage of ml_kem::DecapsulationKey #65

Open
jmwample opened this issue Sep 23, 2024 · 1 comment · May be fixed by #81
Open

Downstream library usage of ml_kem::DecapsulationKey #65

jmwample opened this issue Sep 23, 2024 · 1 comment · May be fixed by #81

Comments

@jmwample
Copy link

jmwample commented Sep 23, 2024

I am having a difficult time working with the ml_kem library given what is and isn't public and I would appreciate if anyone has insight or if we could potentially make public some of the private traits.

I am writing a library that serializes encapsulation keys using a custom algorithm (see kemeleon if interested). In order to accomplish the things I need I needed to wrap the EncapsulationKey, DecapsulationKey types. However it is exceedingly difficult to do so as the PkeParams and KemParams traits required by the ::kem::DecapsulationKey<P:KemParams> are private.

For now I have gotten around this by wrapping P::DecapsulationKey where P: KemCore. But this has problems as well. For example when attempting to serialize the decapsulation key to file and the de-serialize it again later, I in theory want to call DecapsulationKey<P>::encapsulation_key() to recover the associated encapsulation key. But this is not possible through the KemCore::DecapsulationKey associated type because you are required to interact with it using the trait bounds.

What I am left with, when I wish to serialize / de-serialize the decapsulation key is to serialize both the decapsulation key and the encapsulation key together -- which seems like the wrong solution here.


Would it be possible to make the KemParams (and PkeParams) trait public so that wrapping / adding extra functionality to ml-kem keys downstream is easier?

I am happy to implement this change and make a PR myself, I just want to see if there is something I am missing or some reason this change would be frowned upon before I start.

@tarcieri
Copy link
Member

That seems OK to me /cc @bifurcation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants