Skip to content

Should PaddingScheme and SignatureScheme be object safe? #261

@tarcieri

Description

@tarcieri

In #260 it was pointed out that PaddingScheme isn't object safe.

I think the purpose of these traits is to provide runtime dynamism around key usages, which makes the lack of object safety a bit problematic.

Especially with #259 complementing the existing signature-related SigningKey/VerifyingKey types with nice monomorphic purpose-dedicated encryption-related counterparts, that would make for a nice split between those providing a performance-oriented, type-safe monomorphic API, and PaddingScheme/SignatureScheme could evolve to focus on runtime dynamism.

Making that work would involve quite a bit of refactoring, getting rid of the generic parameters on the methods and replacing them with dyn Trait, namely for the PrivateKey, PublicKey, and CryptoRngCore traits. This would in turn require finding some way to make the PrivateKey and PublicKey traits object safe. At that point, we might consider trying to recombine the four traits (PaddingScheme, SignatureScheme, PublicKey, PrivateKey) somehow.

Metadata

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