Documentation ¶
Index ¶
Constants ¶
View Source
const ( XBCryptHashLen = 32 AESBlockSize = 16 MaxChunkSize = math.MaxInt32 MagicLen = 8 ReservedBytesSize = 8 OriginalSizeBytesSize = unsafe.Sizeof(ChunkHeader{}.OriginSize) EncryptedSizeBytesSize = unsafe.Sizeof(ChunkHeader{}.EncryptedSize) ChecksumBytesSize = 4 IVSizeBytesSize = 8 ChunkHeaderFixSize = MagicLen + ReservedBytesSize + OriginalSizeBytesSize + EncryptedSizeBytesSize + ChecksumBytesSize MagicStr1 = "XBCRYP01" MagicStr2 = "XBCRYP02" MagicStr3 = "XBCRYP03" )
Variables ¶
View Source
var ( ChunkMagic1 = []byte(MagicStr1) ChunkMagic2 = []byte(MagicStr2) ChunkMagic3 = []byte(MagicStr3) )
magics
View Source
var ( ErrReadMagic = errors.New("read magic failed") ErrReadHeaderFix = errors.New("read header fix failed") ErrReadReserved = errors.New("read reserved failed") ErrReadOriginalSize = errors.New("read original size failed") ErrReadEncryptedSize = errors.New("read encrypted size failed") ErrReadChecksum = errors.New("read checksum failed") ErrReadIVSize = errors.New("read iv size failed") ErrReadIV = errors.New("read iv failed") ErrReadEncryptedData = errors.New("read encrypted data failed") ErrReadHash = errors.New("read hash failed") ErrHashNotMatch = errors.New("hash not match") ErrDecrypt = errors.New("decrypt failed") ErrExceedExtractSize = errors.New("exceed extract size") )
errors
Functions ¶
This section is empty.
Types ¶
type Chunk ¶
type Chunk struct { ChunkHeader ChunkEncrypted }
type ChunkEncrypted ¶
type ChunkHeader ¶
type DecryptContext ¶
type DecryptContext struct {
// contains filtered or unexported fields
}
DecryptContext provides sequential access to chunks from an xbstream. Each chunk returned represents a contiguous set of bytes for a file stored in the xbstream archive. The Next method advances the stream and returns the next chunk in the archive. Each archive then acts as a reader for its contiguous set of bytes
func NewDecryptContext ¶
func NewReader ¶
func NewReader(reader io.Reader) *DecryptContext
NewReader creates a new Reader by wrapping the provided reader
func (*DecryptContext) CheckMagicVersion ¶
func (dc *DecryptContext) CheckMagicVersion() (err error)
func (*DecryptContext) Next ¶
func (dc *DecryptContext) Next(w io.Writer) (err error)
Next advances the Reader and returns the next Chunk.
func (*DecryptContext) NextHeader ¶
func (dc *DecryptContext) NextHeader() (err error)
NextHeader reads the next chunk header from the reader
func (*DecryptContext) ProcessChunks ¶
func (dc *DecryptContext) ProcessChunks() (err error)
Click to show internal directories.
Click to hide internal directories.