ksm

package
v0.0.0-...-6fa0837 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const APPLE_TESTING_ASk = "d87ce7a26081de2e8eb8acef3a6dc179"
View Source
const NB_RD = 16
View Source
const PRIME = uint32(813416437)

Variables

This section is empty.

Functions

func DebugCKC

func DebugCKC(ckcplayback []byte)

DebugCKC debbug ckcplayback content

Types

type CKCContainer

type CKCContainer struct {
	CKCVersion       uint32 //0x00000001
	Reserved         []byte
	CKCDataInitV     []byte //A random 16-byte initialization vector, generated by the KSM
	CKCPayload       []byte //A variable-length set of contiguous TLLV blocks
	CKCPayloadLength uint32 //The number of bytes in the encrypted CKC payload.
}

CKCContainer represents a container to contain CKC message filed.

func (*CKCContainer) Serialize

func (c *CKCContainer) Serialize() []byte

Serialize serializes CKCContainer message byte array.

type CKCPayload

type CKCPayload struct {
	SK             []byte //Session key
	HU             []byte
	R1             []byte
	IntegrityBytes []byte
}

CKCPayload is a object that store ckc payload.

type CkcContentKeyDurationBlock

type CkcContentKeyDurationBlock struct {
	*TLLVBlock

	LeaseDuration  uint32 // 16-19, The duration of the lease, if any, in seconds.
	RentalDuration uint32 // 20-23, The duration of the rental, if any, in seconds.
	KeyType        uint32 // 24-27,The key type.

}

CkcContentKeyDurationBlock represents a ckc content key duration block structure.

func NewCkcContentKeyDurationBlock

func NewCkcContentKeyDurationBlock(LeaseDuration, RentalDuration uint32) *CkcContentKeyDurationBlock

NewCkcContentKeyDurationBlock creates a new a ckc content key duration block object using the specified lease duration and rental duration.

type CkcDataIv

type CkcDataIv struct {
	IV []byte
}

CkcDataIv represents a ckc data iv structure.

type CkcEncryptedPayload

type CkcEncryptedPayload struct {
	Payload []byte
}

CkcEncryptedPayload represents a ckc encrypted payload structure.

type CkcR1

type CkcR1 struct {
	R1 []byte
}

CkcR1 represents a ckcR1 structure.

type ContentKey

type ContentKey interface {
	FetchContentKey(assetID []byte) ([]byte, []byte, error)
	FetchContentKeyDuration(assetID []byte) (*CkcContentKeyDurationBlock, error)
}

ContentKey is a interface that fetch asset content key and duration.

type DFunction

type DFunction struct {
}

func (DFunction) Compute

func (d DFunction) Compute(R2 []byte, ask []byte) ([]byte, error)

func (DFunction) ComputeHashValue

func (d DFunction) ComputeHashValue(R2 []byte) ([]byte, error)

type DecryptedSKR1Payload

type DecryptedSKR1Payload struct {
	SK             []byte //Session key
	HU             []byte
	R1             []byte
	IntegrityBytes []byte
}

DecryptedSKR1Payload represents a decrypted SKR1 payload structure.

type Ksm

type Ksm struct {
	Pub *rsa.PublicKey
	Pri *rsa.PrivateKey
	Rck ContentKey
	Ask []byte
	// contains filtered or unexported fields
}

Ksm represents a ksm object.

func (*Ksm) GenCKC

func (k *Ksm) GenCKC(playback []byte) ([]byte, error)

GenCKC computes the incoming server playback context (SPC message) returned to client by the SKDServer library.

type RandomContentKey

type RandomContentKey struct {
}

RandomContentKey is a object that implements ContentKey interface.

func (RandomContentKey) FetchContentKey

func (RandomContentKey) FetchContentKey(assetID []byte) ([]byte, []byte, error)

FetchContentKey returns content key and iv for the given assetId.

func (RandomContentKey) FetchContentKeyDuration

func (RandomContentKey) FetchContentKeyDuration(assetID []byte) (*CkcContentKeyDurationBlock, error)

FetchContentKeyDuration returns CkcContentKeyDurationBlock for the given assetId.

type SKR1TLLVBlock

type SKR1TLLVBlock struct {
	TLLVBlock
	IV      []byte
	Payload []byte
}

SKR1TLLVBlock represents a SKR1 TLLV block structure.

type SPCContainer

type SPCContainer struct {
	Version           uint32
	Reserved          []byte
	AesKeyIV          []byte
	EncryptedAesKey   []byte
	CertificateHash   []byte
	SPCPlayload       []byte
	SPCPlayloadLength uint32

	TTLVS map[uint64]TLLVBlock
}

SPCContainer represents a container to contain SPC message filed.

func ParseSPCV1

func ParseSPCV1(playback []byte, pub *rsa.PublicKey, pri *rsa.PrivateKey) (*SPCContainer, error)

ParseSPCV1 parses playback, public and private key pairs to new a SPCContainer instance. ParseSPCV1 returns an error if playback can't be parsed.

type TLLVBlock

type TLLVBlock struct {
	Tag         uint64
	BlockLength uint32
	ValueLength uint32 //The number of bytes in the value field. This number may be any amount, including 0x0000
	Value       []byte
}

TLLVBlock represents a TLLV block structure.

func NewTLLVBlock

func NewTLLVBlock(tag uint64, value []byte) *TLLVBlock

NewTLLVBlock creates a new TLLVBlock object using the specified tag and value.

func (*TLLVBlock) Serialize

func (t *TLLVBlock) Serialize() ([]byte, error)

Serialize returns serialize byte array.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL