Updated CryptographyClientImpl to return a versioned keyId where applicable#47822
Merged
Updated CryptographyClientImpl to return a versioned keyId where applicable#47822
CryptographyClientImpl to return a versioned keyId where applicable#47822Conversation
Contributor
There was a problem hiding this comment.
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
EncryptResultto useKeyOperationResult.getKid()forkeyId. - Updated
DecryptResultto useKeyOperationResult.getKid()forkeyId. - Updated
SignResult,WrapResult, andUnwrapResultto useKeyOperationResult.getKid()forkeyId.
...ava/com/azure/security/keyvault/keys/cryptography/implementation/CryptographyClientImpl.java
Show resolved
Hide resolved
...ava/com/azure/security/keyvault/keys/cryptography/implementation/CryptographyClientImpl.java
Show resolved
Hide resolved
heaths
approved these changes
Jan 27, 2026
Member
heaths
left a comment
There was a problem hiding this comment.
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.
Member
Author
|
@heaths Added a few more check to our unit tests, including one for kid version |
heaths
approved these changes
Jan 28, 2026
...keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java
Outdated
Show resolved
Hide resolved
alzimmermsft
approved these changes
Feb 9, 2026
alzimmermsft
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
General Guidelines and Best Practices
Testing Guidelines