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

[Request] Allow generation of secrets of arbitrary size #374

Open
PhilippGackstatter opened this issue Jun 3, 2022 · 0 comments
Open

[Request] Allow generation of secrets of arbitrary size #374

PhilippGackstatter opened this issue Jun 3, 2022 · 0 comments

Comments

@PhilippGackstatter
Copy link
Contributor

PhilippGackstatter commented Jun 3, 2022

Description

Provide a procedure that can generate secrets of arbitrary size.

Motivation

Currently, procedures::GenerateKey takes a KeyType and generates a key of appropriate size. However, for some encryption operations, a key of some other length might be required that is not covered by those KeyTypes. For instance, when generating a random encryption key for use with Aes256Gcm, then a key of length crypto::ciphers::aes::Aes256Gcm::KEY_LENGTH is required. This happens to be the same as the size of an X25519 private key, so we can currently hack around it that way. But a proper solution would be to offer a procedure that takes a len: usize or extend the KeyType enum to cover all possible use cases stronghold currently offers.

Requirements

Write a list of what you want this feature to do.

  1. Add a new procedure (or rewrite GenerateKey and add a KeyType::key_length method that returns the key size for the enum variants) that takes a len: usize and location: Location and writes len random bytes to location.

Open questions (optional)

Unclear if rewriting GenerateKey is the way to go, or if another procedure should be added.

Are you planning to do it yourself in a pull request?

Possibly.

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

No branches or pull requests

1 participant