pkg

package
v0.0.0-...-6242dc4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const EntryTypePSP = 0x90

Variables

View Source
var KeyPS3 = []byte{
	0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e,
	0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8,
}
View Source
var KeyPSP = []byte{
	0x07, 0xf2, 0xc6, 0x82, 0x90, 0xb5, 0x0d, 0x2c,
	0x33, 0x81, 0x8d, 0x70, 0x9b, 0x60, 0xe6, 0x2b,
}
View Source
var KeyVita3 = []byte{
	0x42, 0x3a, 0xca, 0x3a, 0x2b, 0xd5, 0x64, 0x9f,
	0x96, 0x86, 0xab, 0xad, 0x6f, 0xd8, 0x80, 0x1f,
}
View Source
var KeyVita4 = []byte{
	0xaf, 0x07, 0xfd, 0x59, 0x65, 0x25, 0x27, 0xba,
	0xf1, 0x33, 0x89, 0x66, 0x8b, 0x17, 0xd9, 0xea,
}
View Source
var VitaKey2 = []byte{
	0xe3, 0x1a, 0x70, 0xc9, 0xce, 0x1d, 0xd7, 0x2b,
	0xf3, 0xc0, 0x62, 0x29, 0x63, 0xf2, 0xec, 0xcb,
}

Functions

func AESCTRDecrypt

func AESCTRDecrypt(block cipher.Block, dst, src, iv []byte, counter int64)

func AESECBEncrypt

func AESECBEncrypt(dst, src, key []byte) error

func DecodeLicense

func DecodeLicense(src string, pkgType PackageType) ([]byte, error)

func EncodeLicense

func EncodeLicense(data []byte) (string, error)

func NewCTR

func NewCTR(b cipher.Block, iv []byte, counter int64) cipher.Stream

func NewCTRReader

func NewCTRReader(r io.Reader, key, iv []byte, counter int64) (*ctrStream, error)

Types

type ContentTypeEnum

type ContentTypeEnum uint32
const (
	ContentTypePS1     ContentTypeEnum = 0x6
	ContentTypePSP     ContentTypeEnum = 0x7
	ContentTypePSPGo   ContentTypeEnum = 0xe
	ContentTypeMinis   ContentTypeEnum = 0xf
	ContentTypeNeoGeo  ContentTypeEnum = 0x10
	ContentTypeVitaApp ContentTypeEnum = 0x15
	ContentTypeVitaDLC ContentTypeEnum = 0x16
	ContentTypePSM1    ContentTypeEnum = 0x18
	ContentTypePSM2    ContentTypeEnum = 0x1c
)

type ExtendedHeader

type ExtendedHeader struct {
	Magic       [4]byte
	Unknown1    uint32
	HeaderSize  int32
	DataSize    int32
	DataOffset  int32
	DataType    uint32
	PkgDataSize int64

	DataType2 uint32
	Unknown2  uint32
	// contains filtered or unexported fields
}

func (*ExtendedHeader) KeyType

func (h *ExtendedHeader) KeyType() int

type FileHeader

type FileHeader struct {
	Magic      [4]byte
	Revision   uint16
	Type       uint16
	InfoOffset int32
	InfoCount  int32
	HeaderSize int32
	ItemCount  int32
	TotalSize  int64
	DataOffset int64
	DataSize   int64
	ContentID  [36]byte

	Digest               [16]byte
	DataIV               [16]byte
	HeaderCmacHash       [16]byte
	HeaderNpdrmSignature [40]byte
	HeaderSha1Hash       [8]byte
	// contains filtered or unexported fields
}

func (*FileHeader) GetContentID

func (h *FileHeader) GetContentID() string

func (*FileHeader) GetContentName

func (h *FileHeader) GetContentName() string

func (*FileHeader) GetTitleID

func (h *FileHeader) GetTitleID() string

type FileTypeEnum

type FileTypeEnum int
const (
	FileTypeFile0         FileTypeEnum = 0
	FileTypeFile1         FileTypeEnum = 1
	FileTypeFileEdat      FileTypeEnum = 2
	FileTypeFile3         FileTypeEnum = 3
	FileTypeDirectory     FileTypeEnum = 4
	FileTypeFileDocinfo   FileTypeEnum = 5
	FileTypeFilePbp       FileTypeEnum = 6
	FileTypeFileModule    FileTypeEnum = 14
	FileTypeFile15        FileTypeEnum = 15
	FileTypeFileKeystone  FileTypeEnum = 16
	FileTypeFilePfs       FileTypeEnum = 17
	FileTypeDirectoryPfs  FileTypeEnum = 18
	FileTypeFileTemp      FileTypeEnum = 19
	FileTypeFileInst      FileTypeEnum = 20
	FileTypeFileClearsign FileTypeEnum = 21
	FileTypeFileSys       FileTypeEnum = 22
	FileTypeFileDigs      FileTypeEnum = 24
)

type IdentifierType

type IdentifierType uint32
const (
	IdentifierDRMType       IdentifierType = 0x1
	IdentifierContentType   IdentifierType = 0x2
	IdentifierPackageFlags  IdentifierType = 0x3
	IdentifierFileIndexInfo IdentifierType = 0xd
	IdentifierSFO           IdentifierType = 0xe
)

type InfoHeader

type InfoHeader struct {
	Type IdentifierType
	Size int32
}

type ItemRecord

type ItemRecord struct {
	FilenameOffset uint32
	FilenameSize   int32
	DataOffset     int64
	DataSize       int64
	Flags          uint32
	Reserved       uint32
}

func (*ItemRecord) KeyType

func (h *ItemRecord) KeyType() uint16

type Metadata

type Metadata struct {
	DrmType          uint32
	ContentType      ContentTypeEnum
	PackageFlags     uint32
	IndexTableOffset uint32
	IndexTableSize   uint32
	SfoOffset        uint32
	SfoSize          uint32
}

type PackageType

type PackageType int
const (
	PackageTypePSOne PackageType = 1 << iota
	PackageTypePSP
	PackageTypeVitaApp
	PackageTypeVitaDLC
	PackageTypeVitaPatch
	PackageTypePSM
)

type ReadCloser

type ReadCloser struct {
	Reader
	// contains filtered or unexported fields
}

func OpenReader

func OpenReader(name string, rif string) (*ReadCloser, error)

func (*ReadCloser) Close

func (rc *ReadCloser) Close() error

type Reader

type Reader struct {

	// pkg header
	FileHeader FileHeader

	SfoEntries map[string]string

	// hashes, calculated and from file
	FileHash       []byte
	CalculatedHash []byte
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader, rif string) (*Reader, error)

func (*Reader) CreateZip

func (pr *Reader) CreateZip(outDir string) error

func (*Reader) GetRegion

func (pr *Reader) GetRegion() string

func (*Reader) GetTitle

func (pr *Reader) GetTitle() string

func (*Reader) GetTitleID

func (pr *Reader) GetTitleID() string

func (*Reader) HeadWriter

func (pr *Reader) HeadWriter(w io.Writer) (int64, error)

func (*Reader) Next

func (pr *Reader) Next() (*fileEntry, error)

func (*Reader) PackageType

func (pr *Reader) PackageType() PackageType

func (*Reader) Read

func (pr *Reader) Read(b []byte) (int, error)

func (*Reader) TailWriter

func (pr *Reader) TailWriter(w io.Writer) (int64, error)

func (*Reader) Unpack

func (pr *Reader) Unpack(outDir string) error

func (*Reader) Valid

func (pr *Reader) Valid() bool

Jump to

Keyboard shortcuts

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