KMP PHP API Reference

BackupStreamCipher
in package

FinalYes

Reads and writes bounded-memory, authenticated backup archive streams.

Table of Contents

Constants

ALGORITHM  : mixed = 'XCHACHA20-POLY1305-SECRETSTREAM'
MAGIC  : mixed = "KMPBACKUP\x02"
CHUNK_BYTES  : mixed = 4 * 1024 * 1024
MAX_HEADER_BYTES  : mixed = 64 * 1024

Methods

decryptFile()  : bool
Decrypt a version 2 archive. Returns false when the input uses the legacy JSON format.
encryptFile()  : void
readExact()  : string
unpackLength()  : int
writeAll()  : void

Constants

Methods

decryptFile()

Decrypt a version 2 archive. Returns false when the input uses the legacy JSON format.

public decryptFile(string $inputPath, string $outputPath, string $dataEncryptionKey, string $aad, array<string, scalar> $expectedMetadata) : bool
Parameters
$inputPath : string
$outputPath : string
$dataEncryptionKey : string
$aad : string
$expectedMetadata : array<string, scalar>
Return values
bool

encryptFile()

public encryptFile(string $inputPath, string $outputPath, string $dataEncryptionKey, string $aad, array<string, scalar> $archiveMetadata) : void
Parameters
$inputPath : string
$outputPath : string
$dataEncryptionKey : string
$aad : string
$archiveMetadata : array<string, scalar>

readExact()

private readExact(resource $stream, int $length, string $label) : string
Parameters
$stream : resource
$length : int
$label : string
Return values
string

unpackLength()

private unpackLength(string $bytes) : int
Parameters
$bytes : string
Return values
int

writeAll()

private writeAll(resource $stream, string $bytes) : void
Parameters
$stream : resource
$bytes : string
On this page

Search results