user_session_key.go 695 B

1234567891011121314151617181920212223242526272829
  1. package mstypes
  2. import (
  3. "encoding/binary"
  4. "gopkg.in/jcmturner/gokrb5.v2/ndr"
  5. )
  6. // CypherBlock implements https://msdn.microsoft.com/en-us/library/cc237040.aspx
  7. type CypherBlock struct {
  8. Data []byte // size = 8
  9. }
  10. // UserSessionKey implements https://msdn.microsoft.com/en-us/library/cc237080.aspx
  11. type UserSessionKey struct {
  12. Data []CypherBlock // size = 2
  13. }
  14. // ReadUserSessionKey reads a UserSessionKey from the bytes slice.
  15. func ReadUserSessionKey(b *[]byte, p *int, e *binary.ByteOrder) UserSessionKey {
  16. cb1 := CypherBlock{
  17. Data: ndr.ReadBytes(b, p, 8, e),
  18. }
  19. cb2 := CypherBlock{
  20. Data: ndr.ReadBytes(b, p, 8, e),
  21. }
  22. return UserSessionKey{
  23. Data: []CypherBlock{cb1, cb2},
  24. }
  25. }