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