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

Investigate a SignClient for just-in-time key creation #70

Closed
hug-dev opened this issue Feb 1, 2021 · 3 comments
Closed

Investigate a SignClient for just-in-time key creation #70

hug-dev opened this issue Feb 1, 2021 · 3 comments
Labels
enhancement New feature or request large Effort label

Comments

@hug-dev
Copy link
Member

hug-dev commented Feb 1, 2021

For use-cases where you just want to sign data easily and securely without having to care about the signing algorithm chosen and the name of the key (because maybe you will only use one), it might be useful to create a new abstract client which:

  • is based on the BasicClient: automatic authenticator and provider selection
  • automatically choose the asymmetric signing algorithm which is going to be used and the key properties: RSA or ECC? Which curve (if ECC)? Which key length? PKCS#1 v1.5 or PSS (if RSA)?
  • generate a key pair (if it does not exist) with those properties with a fixed named (sign-client-key)
  • provides the following methods:

The methods leverage the RustCrypto traits and types so that the client is idiomatic and can easily be used in contexts where other implementations of those traits are used, but with Parsec. Fix #6

A possible simplification of this, is not to abstract over all possible signature/public key types but only focus on one, let's say ecdsa using the ecdsa crate. SignClient could be EcdsaSignClient or we hide this to the developper. Maybe in the future we will want RsaSignClient though (but the RustCrypto rsa crate does not yet support integration with the signature traits).

Testing

A good way to test this would be to find dependent crates of the signature traits and ecdsa (here) and replace their signature::Signer implementation with the Parsec Client's one and see if it works.

@hug-dev
Copy link
Member Author

hug-dev commented Feb 3, 2021

Ok maybe it's too soon to look at implementing the RustCrypto traits for now. Or not at this step. The signature traits do not define key management operations so they can not be used that easily in all contexts. If there is demand and it makes integration with existing crates easier, we can implement them on some abstracted structures. But it could happen that it's as easy as using our crate with the existing types/methods than the signature traits ones.

To focus on the SignClient (and also EncryptClient) for now, I propose to create a new AutomaticClient based on BasicClient.
It will have those methods:

  • generating key pairs (for as. signing and as. encryption) with automatic selection of: key type (RSA or ECC with automatic selection of curve), key length, algorithm to use with it
  • signing: with no argument use a key automatically generated just-in-time with a hardcoded name, otherwise use the generated key with method above
  • decrypting: same behaviour than above
  • exporting public key: same behaviour, maybe returning an abstracted type and add methods to change its format.

parsec-tool could be based on top of that client for ease of use.

@ionut-arm ionut-arm added enhancement New feature or request large Effort label labels Feb 3, 2021
@hug-dev
Copy link
Member Author

hug-dev commented Feb 4, 2021

See also the discussion here on Slack

@hug-dev
Copy link
Member Author

hug-dev commented Apr 29, 2021

The initial investigation was done.

@hug-dev hug-dev closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request large Effort label
Projects
None yet
Development

No branches or pull requests

2 participants