feat(messages): add Marshal for APRep and EncAPRepPart - #98
Open
hstern wants to merge 1 commit into
Open
Conversation
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>
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
RFC 4120
KRB_AP_REP(messages.APRep) and its encrypted part (messages.EncAPRepPart) implementUnmarshalbut have noMarshal, 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
Marshalmethods, mirroring the existingKRBError.Marshalpattern:asn1.Marshalfollowed byAddASNAppTagwith theAPREP(15) andEncAPRepPart(27) application tags.Testing
Byte-exact round-trip tests (
Unmarshal→Marshal→ compare bytes) against the existing MIT-generatedtestdatafixtures, including the optionals-absentEncAPRepPartcase:TestMarshalAPRepTestMarshalEncAPRepPartTestMarshalEncAPRepPart_optionalsNULLgo test ./messages/,go build ./...,go vet ./..., andgofmtare all clean.🤖 Generated with Claude Code