Skip to content

Feature: AsymmetricKey::generate_another()#3770

Merged
reneme merged 3 commits intorandombit:masterfrom
Rohde-Schwarz:feature/pubkey_create_another
Oct 25, 2023
Merged

Feature: AsymmetricKey::generate_another()#3770
reneme merged 3 commits intorandombit:masterfrom
Rohde-Schwarz:feature/pubkey_create_another

Conversation

@reneme
Copy link
Copy Markdown
Collaborator

@reneme reneme commented Oct 23, 2023

As suggested in #3706, this adds ::generate_another(RNG&). Given some (abstract) asymmetric key object, one can simply generate another equivalent key pair that uses the same algorithm and parameters. This comes in handy if one needs to generate an ephemeral key pair for a public key received from a peer.

Currently, the new method is used in the KEX_to_KEM_Adapter class, only. Though, the DLIES and ECIES implementation might benefit from them as well. At first glance, their APIs appeared to require a bit of a make-over to benefit from ::generate_another(). I've left this for future work.
Similarly, the PKCS#11 key variants are left for future work -- currently throwing Not_Implemented. It remains to-be-discussed whether ::generate_another() should generate a software instance of the given asymmetric algorithm or whether they should attempt to generate an equivalent keypair via PKCS#11.

@reneme reneme added the enhancement Enhancement or new feature label Oct 23, 2023
@reneme reneme added this to the Botan 3.3.0 milestone Oct 23, 2023
@reneme reneme requested a review from randombit October 23, 2023 15:10
@reneme reneme self-assigned this Oct 23, 2023
@reneme reneme force-pushed the feature/pubkey_create_another branch 2 times, most recently from 02fec16 to 2e99e4f Compare October 24, 2023 08:56
Given some abstract public or private key, downstream users can generate
another keypair with the same algorithm parameters. This is most-useful
for generating ephemeral key-agreement keys.
@reneme reneme force-pushed the feature/pubkey_create_another branch from 2e99e4f to a878ffa Compare October 24, 2023 12:28
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 91.69% (-0.02%) from 91.705% when pulling a878ffa on Rohde-Schwarz:feature/pubkey_create_another into 3a02016 on randombit:master.

Copy link
Copy Markdown
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@reneme reneme merged commit 11b5d80 into randombit:master Oct 25, 2023
@reneme reneme deleted the feature/pubkey_create_another branch October 25, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants