Skip to content

Downstream library usage of ml_kem::DecapsulationKey #65

Open
@jmwample

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions