Skip to content

nil external data should imply empty slice, not nil #8

@shizhMSFT

Description

@shizhMSFT

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions