Skip to content

Updated CryptographyClientImpl to return a versioned keyId where applicable#47822

Merged
vcolin7 merged 7 commits intomainfrom
keyvault/fix-keyid-in-cryptoclient-operations
Feb 26, 2026
Merged

Updated CryptographyClientImpl to return a versioned keyId where applicable#47822
vcolin7 merged 7 commits intomainfrom
keyvault/fix-keyid-in-cryptoclient-operations

Conversation

@vcolin7
Copy link
Member

@vcolin7 vcolin7 commented Jan 27, 2026

Description

Fixes: #43451

Fixed an issue where cryptographic operation results (SignResult, EncryptResult, DecryptResult, WrapResult, UnwrapResult) returned a versionless key ID instead of the full versioned key ID returned by the service. This caused issues when attempting roundtrip scenarios, as callers couldn't determine which key version was used for the original operation (e.g. Sign -> Verify).

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@vcolin7 vcolin7 requested review from heaths and samvaity January 27, 2026 22:11
@vcolin7 vcolin7 self-assigned this Jan 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Key Vault cryptography operation results to return the service-returned (versioned) key identifier (kid) instead of the client’s (potentially unversioned) keyId, enabling correct roundtrip scenarios when key rotation is used (e.g., sign→verify, wrap→unwrap).

Changes:

  • Updated EncryptResult to use KeyOperationResult.getKid() for keyId.
  • Updated DecryptResult to use KeyOperationResult.getKid() for keyId.
  • Updated SignResult, WrapResult, and UnwrapResult to use KeyOperationResult.getKid() for keyId.

Copy link
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

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

Given your changelog entry, this would seem right but without seeing any tests or knowing your code from memory, does getKid() return the full URI including version? Might be good to add a test or even an assertion to existing tests to make sure you do indeed have a version.

@vcolin7
Copy link
Member Author

vcolin7 commented Jan 28, 2026

@heaths Added a few more check to our unit tests, including one for kid version

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure SDK for Key Vault Feb 26, 2026
@vcolin7 vcolin7 enabled auto-merge (squash) February 26, 2026 20:04
@vcolin7 vcolin7 merged commit debbb5b into main Feb 26, 2026
19 checks passed
@vcolin7 vcolin7 deleted the keyvault/fix-keyid-in-cryptoclient-operations branch February 26, 2026 20:24
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure SDK for Key Vault Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] SignResult keyId is missing the version information of the key used

4 participants