Package widevine (v1.9.3) [up] [repository]

crypto.go

errors.go

pssh.go

request.go

response.go

Index

Functions

func DecodePrivateKey(pemData []byte) (*rsa.PrivateKey, error)
func EncodeSignedMessage(requestData []byte, privateKey *rsa.PrivateKey) ([]byte, error)

EncodeSignedMessage envelopes the request with an RSA signature.

func GetKey(keys []*KeyContainer, id []byte) ([]byte, error)

GetKey searches for a key by its ID in a slice of KeyContainers. If the key is found, it returns the key and a nil error. If the key is not found, it returns nil and an error.

Types

type KeyContainer

type KeyContainer struct {
	Id  []byte
	Iv  []byte
	Key []byte
}

Functions

func DecodeLicenseResponse(responseData []byte, requestData []byte, privateKey *rsa.PrivateKey) ([]*KeyContainer, error)

type LicenseError

LicenseError reflects the structure of the Widevine LicenseError protobuf.

type LicenseError struct {
	ErrorCode *protobuf.Field
}

Methods

func (le *LicenseError) Error() string

Error implements the standard Go error interface.

type PsshData

PsshData represents the Widevine-specific protobuf message.

type PsshData struct {
	KeyIds    [][]byte
	ContentId []byte
}

Functions

func DecodePsshData(data []byte) (*PsshData, error)

DecodePsshData parses the protobuf wire format into a PsshData struct.

Methods

func (p *PsshData) Encode() ([]byte, error)

Encode serializes the PsshData struct into the protobuf wire format.

func (p *PsshData) EncodeLicenseRequest(clientId []byte) ([]byte, error)

EncodeLicenseRequest creates and serializes a LicenseRequest protobuf message.