{"record":{"id":"8d0a4735285aa38c","repo":"canopy-network/canopy","slug":"unrecognized-public-key-format-8d0a47","errorCode":null,"errorMessage":"unrecognized public key format","messagePattern":"unrecognized public key format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/crypto/key_batch.go","lineNumber":91,"sourceCode":"\t\t// exit\n\t\treturn nil\n\t}\n\t// initialize the batch tuple object and append to the proper list\n\tt := BatchTuple{PublicKey: pk, Message: message, Signature: signature, index: b.count}\n\tlistIdx := b.count % 8\n\t// classify by the decoded key type so serialized multisig keys follow the same path\n\t// as one-by-one verification through NewPublicKeyFromBytes().\n\tswitch pk.(type) {\n\tcase *ED25519PublicKey:\n\t\tb.ed25519[listIdx] = append(b.ed25519[listIdx], t)\n\tcase *ETHSECP256K1PublicKey:\n\t\tb.ethSecp256k1[listIdx] = append(b.ethSecp256k1[listIdx], t)\n\tcase *SECP256K1PublicKey:\n\t\tb.secp256k1[listIdx] = append(b.secp256k1[listIdx], t)\n\tcase *BLS12381PublicKey, *BLS12381MultiPublicKey:\n\t\tb.bls12381[listIdx] = append(b.bls12381[listIdx], t)\n\tdefault:\n\t\treturn fmt.Errorf(\"unrecognized public key format\")\n\t}\n\t// increment the global count\n\tb.count++\n\t// exit\n\treturn\n}\n\n// Count() returns the number of signatures added to the batch verifier.\nfunc (b *BatchVerifier) Count() int {\n\tif b == nil {\n\t\treturn 0\n\t}\n\treturn b.count\n}\n\n// Verify() returns the indices of bad signatures (if any)\nfunc (b *BatchVerifier) Verify() (badIndices []int) {\n\t// initialize sync variables","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/lib/crypto/key_batch.go#L73-L109","documentation":"Raised in the batch verifier Add method when a key submitted for batched verification has a byte length matching no supported public key format. The same guard as NewPublicKeyFromBytes but applied at batch-accept time, so a malformed signature tuple is rejected before being queued into a typed batch bucket.","triggerScenarios":"Thrown at lib/crypto/key_batch.go:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the key's byte length/format before adding the tuple to the batch verifier.","Ensure multisig (serialized multi-BLS) keys go through the same decoding used by NewPublicKeyFromBytes.","Check callers like CheckSignature for corrupted or truncated key bytes in the signature payload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}