Skip to content

Conversation

@BastienClement
Copy link

When generating 256-bit encryption keys in the version 2 (JWK) format,
the algorithm was incorrectly labeled as 192-bit in the output JSON.
This change ensures the label correctly reflects the 256-bit size.

Resolves: #160004

Release note (bug fix): Fixed a bug where 256-bit encryption keys
generated in the V2 (JWK) format were incorrectly labeled as 192-bit.

Epic: None

When generating 256-bit encryption keys in the version 2 (JWK) format,
the algorithm was incorrectly labeled as 192-bit in the output JSON.
This change ensures the label correctly reflects the 256-bit size.

Resolves: cockroachdb#160004

Release note (bug fix): Fixed a bug where 256-bit encryption keys
generated in the V2 (JWK) format were incorrectly labeled as 192-bit.

Epic: None
Copilot AI review requested due to automatic review settings December 22, 2025 12:34
@BastienClement BastienClement requested a review from a team as a code owner December 22, 2025 12:34
@blathers-crl
Copy link

blathers-crl bot commented Dec 22, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added the O-community Originated from the community label Dec 22, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroachlabs-cla-agent
Copy link

cockroachlabs-cla-agent bot commented Dec 22, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

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 a copy-paste bug where 256-bit encryption keys in the V2 (JWK) format were being incorrectly labeled as 192-bit. The fix ensures proper consistency between encryption type and its JWK algorithm string representation.

Key Changes:

  • Corrected the return value for EncryptionType_AES_256_CTR_V2 to return the correct algorithm string "cockroach-aes-256-ctr-v2" instead of "cockroach-aes-192-ctr-v2"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 24 to +25
case EncryptionType_AES_256_CTR_V2:
return "cockroach-aes-192-ctr-v2", nil
return "cockroach-aes-256-ctr-v2", nil
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The JWKAlgorithm function lacks test coverage. Consider adding tests that verify all encryption types return the correct algorithm strings, especially to prevent similar copy-paste errors in the future. A simple table-driven test that checks both JWKAlgorithm and EncryptionTypeFromJWKAlgorithm for all encryption types would help catch issues like this bug.

Copilot uses AI. Check for mistakes.
@tuansydau tuansydau added the A-storage Relating to our storage engine (Pebble) on-disk storage. label Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-storage Relating to our storage engine (Pebble) on-disk storage. O-community Originated from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: gen encryption-key --size 256 --version 2 produces incorrect "alg" string

3 participants