Repository navigation
accounts: honor configured hash algorithm on Google KMS signer - #233
Draft
vishalchangrani wants to merge 1 commit into
Draft
vishalchangrani wants to merge 1 commit into
vishalchangrani wants to merge 1 commit into
Conversation
Google KMS keys expose a native hash algorithm (SHA2_256 for the EC_SIGN_P256_SHA256 and EC_SIGN_SECP256K1_SHA256 key types), but Flow accounts can be registered with either SHA2_256 or SHA3_256 as the on-chain hash algorithm. Passing the account's HashAlgo() straight through to the KMS signer lets flow-cli sign for accounts whose public key is registered with SHA3_256; the SDK Signer pre-hashes the message client-side and submits the digest, so KMS signs it as-is without re-hashing. Requires onflow/flow-go-sdk#1048. Issue: onflow/flow-cli#2367
jribbink
reviewed
Nov 9, 2026
jribbink
left a comment
Contributor
There was a problem hiding this comment.
Think this changes behavior for existing google-kms keys that don't specify a hashAlgorithm. The signer has effectively assumed SHA2_256 until now, but with this change the default becomes SHA3_256, as it is for other key types when unspecified, so those would start failing. Would it make sense to keep SHA2_256 as the default for google-kms when it's unspecified, so existing setups keep working?
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.
Summary
KMSKey.Signer()now passes the account's configuredHashAlgo()to the Google KMS signer instead of silently letting the KMS key's native algorithm (SHA2_256) win.signature is not valid.SignerForKeyWithHashAlgoand pre-hashes client-side so the KMSAsymmetricSignDigestfield carries the SHA3_256 hash as-is.Tracks the bug reported in flow-cli: onflow/flow-cli#2367
Test plan
go test ./accounts/...passes locally against the SDK branch.flow-go-sdkrelease bump — this PR will not compile against the currently pinnedflow-go-sdk v1.10.9.ECDSA_P256 / SHA3_256backed by GCP KMS (reproduces the failure in the linked flow-cli issue).