1
1
mirror of https://github.com/wader/fq.git synced 2024-12-03 01:33:02 +03:00
fq/format/fairplay/fairplay.go
2022-07-07 17:11:55 +02:00

30 lines
687 B
Go

package fairplay
// https://github.com/easonlin404/ksm/blob/master/ksm.go
import (
"github.com/wader/fq/format"
"github.com/wader/fq/format/registry"
"github.com/wader/fq/pkg/decode"
)
func init() {
registry.MustRegister(decode.Format{
Name: format.FAIRPLAY_SPC,
Description: "FairPlay Server Playback Context",
DecodeFn: fairPlaySPCDecode,
})
}
func fairPlaySPCDecode(d *decode.D, in any) any {
d.FieldU32("version")
d.FieldRawLen("reserved", 32)
d.FieldRawLen("iv", 16*8)
d.FieldRawLen("aes_key_oaep", 128*8)
d.FieldRawLen("certificate_hash", 20*8)
payloadLen := d.FieldU32("payload_length")
d.FieldRawLen("payload", int64(payloadLen)*8)
return nil
}