Skip to content

feat(messages): add Marshal for APRep and EncAPRepPart - #98

Open
hstern wants to merge 1 commit into
go-krb5:masterfrom
hstern:marshal-ap-rep
Open

feat(messages): add Marshal for APRep and EncAPRepPart#98
hstern wants to merge 1 commit into
go-krb5:masterfrom
hstern:marshal-ap-rep

Conversation

@hstern

@hstern hstern commented Jul 5, 2026

Copy link
Copy Markdown

Summary

RFC 4120 KRB_AP_REP (messages.APRep) and its encrypted part (messages.EncAPRepPart) implement Unmarshal but have no Marshal, so there is currently no way to produce an AP-REP — only consume one. This blocks acceptor-side GSS-API work that needs to emit the AP-REP completing mutual authentication.

This adds the symmetric Marshal methods, mirroring the existing KRBError.Marshal pattern: asn1.Marshal followed by AddASNAppTag with the APREP (15) and EncAPRepPart (27) application tags.

Testing

Byte-exact round-trip tests (UnmarshalMarshal → compare bytes) against the existing MIT-generated testdata fixtures, including the optionals-absent EncAPRepPart case:

  • TestMarshalAPRep
  • TestMarshalEncAPRepPart
  • TestMarshalEncAPRepPart_optionalsNULL

go test ./messages/, go build ./..., go vet ./..., and gofmt are all clean.

🤖 Generated with Claude Code

RFC 4120 KRB_AP_REP (messages.APRep) and its encrypted part
(messages.EncAPRepPart) implemented Unmarshal but no Marshal, so callers
had no way to *produce* an AP-REP -- only consume one. This blocks
acceptor-side work that must emit the AP-REP completing mutual
authentication.

Add the symmetric Marshal methods following the existing
KRBError.Marshal idiom: asn1.Marshal + AddASNAppTag with the APREP (15)
and EncAPRepPart (27) application tags.

Byte-exact round-trip tests against the existing MIT-generated testdata
fixtures confirm symmetry with Unmarshal, including the optionals-absent
EncAPRepPart case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant