In RFC8152 4.4, the step 4 states
The protected attributes from the application encoded in a bstr type. If this field is not supplied, it defaults to a zero-length binary string.
Sig_structure = [
context : "Signature1",
body_protected : empty_or_serialized_map,
external_aad : bstr,
payload : bstr
]
That is, when external is nil for Sign and Verify, it should default to []byte{} so that a proper Sig_Structure can be constructed. Otherwise, the go-cose library will fail all verifications agaist signatures generated by other libraries.
Note: []byte{} is 0x40 and nil is 0xf6 in CBOR.
In RFC8152 4.4, the step 4 states
That is, when
externalisnilforSignandVerify, it should default to[]byte{}so that a properSig_Structurecan be constructed. Otherwise, thego-coselibrary will fail all verifications agaist signatures generated by other libraries.Note:
[]byte{}is0x40andnilis0xf6in CBOR.