pac_info_buffer.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package pac
  2. import (
  3. "encoding/binary"
  4. "gopkg.in/jcmturner/gokrb5.v2/ndr"
  5. )
  6. const (
  7. ulTypeKerbValidationInfo = 1
  8. ulTypeCredentials = 2
  9. ulTypePACServerSignatureData = 6
  10. ulTypePACKDCSignatureData = 7
  11. ulTypePACClientInfo = 10
  12. ulTypeS4UDelegationInfo = 11
  13. ulTypeUPNDNSInfo = 12
  14. ulTypePACClientClaimsInfo = 13
  15. ulTypePACDeviceInfo = 14
  16. ulTypePACDeviceClaimsInfo = 15
  17. )
  18. // InfoBuffer implements the PAC Info Buffer: https://msdn.microsoft.com/en-us/library/cc237954.aspx
  19. type InfoBuffer struct {
  20. ULType uint32 // A 32-bit unsigned integer in little-endian format that describes the type of data present in the buffer contained at Offset.
  21. CBBufferSize uint32 // A 32-bit unsigned integer in little-endian format that contains the size, in bytes, of the buffer in the PAC located at Offset.
  22. Offset uint64 // A 64-bit unsigned integer in little-endian format that contains the offset to the beginning of the buffer, in bytes, from the beginning of the PACTYPE structure. The data offset MUST be a multiple of eight. The following sections specify the format of each type of element.
  23. }
  24. // ReadPACInfoBuffer reads a InfoBuffer from the byte slice.
  25. func ReadPACInfoBuffer(b *[]byte, p *int, e *binary.ByteOrder) InfoBuffer {
  26. u := ndr.ReadUint32(b, p, e)
  27. s := ndr.ReadUint32(b, p, e)
  28. o := ndr.ReadUint64(b, p, e)
  29. return InfoBuffer{
  30. ULType: u,
  31. CBBufferSize: s,
  32. Offset: o,
  33. }
  34. }