-
Couldn't load subscription status.
- Fork 563
implement KeyInit and KeySizeUser for SigningKey and VerifyingKey
#733
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
base: main
Are you sure you want to change the base?
Conversation
|
This couples the At the very least this needs a versioning strategy which can tolerate upgrades. |
|
Would gating this behind the Edit: Or we could use |
KeyInit for SigningKeyKeyInit and KeySizeUser for SigningKey and VerifyingKey
|
I believe the work with this PR is done and would be ready for review. |
|
Thank you! I'm confused, though, aren't these traits mostly intended for symmetric primitives? |
|
We don't currently use them with the |
|
I guess I'm not sure how you'd use these traits with a signer in practice. Do you have a use case in mind? |
|
@rozbb the main advantage would probably be having a common trait-based API that can work across several key types, more for consistency than generic abstractions, IMO |
|
I took a look at using |
|
I need a trait based interface for signing key generation because I am working on an cryptographic primitive that is agnostic over its signature scheme. The I think it is fine to still implement these traits as they are meant generalize what the |
|
@carloskiki I would probably suggest using PKCS#8 for a common key init for that purpose, e.g. |
|
With PKCS#8 I need to first encode the bytes and then decode them again in order to generate a key, but I already have the bytes of the private key, I just want to instantiate a signing key with them... |
|
Either way it's a serialization of the key as bytes. PKCS#8 just includes algorithm information and is the "standard" private key format (and also offers features like password-based encryption). It can also be used to dynamically dispatch to various supported algorithms, if you're interested in that sort of thing. It's also available for all of the |
|
I understand that. In my case I still need I can remove the |
|
Edit: or for that matter, Edit again: opened RustCrypto/traits#1897 to discuss a fallible |
|
Maybe something like |
Implements the
KeyInitandKeySizeUsertraits fromcrypto-commonforSigningKeyandVerifyingKey.