Skip to content

EC: Validate local EC domain parameters for MQV key agreement#2272

Closed
Joowon-Seo wants to merge 2 commits intobcgit:mainfrom
Joowon-Seo:fix/ec-keyagreement-parameter-validation
Closed

EC: Validate local EC domain parameters for MQV key agreement#2272
Joowon-Seo wants to merge 2 commits intobcgit:mainfrom
Joowon-Seo:fix/ec-keyagreement-parameter-validation

Conversation

@Joowon-Seo
Copy link

Add validation during MQV key agreement initialisation to ensure
the local static and ephemeral EC keys share the same domain parameters.

Previously these parameters were not explicitly validated, allowing
mismatched keys to proceed until later stages of the agreement.

Tests added for matching and mismatched curve scenarios.

Ensure static and ephemeral EC keys used during MQV initialization
share the same domain parameters and fail early if they differ.

Add tests for matching and mismatched curve scenarios.
@peterdettman
Copy link
Collaborator

The proposed test case ECKeyAgreementDomainValidationTest does not test ECMQV, and already passes without the proposed changes in KeyAgreementSpi. Those KeyAgreementSpi changes are also redundant with checks done by new MQVPrivateParameters(staticPrivKey, ephemPrivKey, ephemPubKey) (The TODO seems a bit obsolete).

It may be worth adding a test case to org.bouncycastle.jce.provider.test.MQVTest confirming the existing checks already work, and also reviewing whether all the other-party keys are also checked when they are available.

@dghgit
Copy link
Contributor

dghgit commented Mar 15, 2026

The new tests are now added (TODO turned out to be not entirely obsolete, escaping exception present...)

@dghgit dghgit closed this Mar 15, 2026
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

Successfully merging this pull request may close these issues.

3 participants