SetaPDF_Signer_TmpDocument Class for handling an intermediate version of the document that should be signed.

File: /SetaPDF v2/Signer/TmpDocument.php

This class is used for an asyncron signature flow. Otherwise it is used internally.

Class hierarchy

Summary

Properties

$_byteRange

The byte range value

$_documentIdentification

Document identification related data

$_hashFileWriter

The writer instance for the 2nd temporary file, that represents the data to hash

$_identficationHash

Hash of the last state of the intermediate document version.

$_writer

The file writer for the temporary version


Methods

__construct()

The constructor

The $writer parameter is optional and can be used in an asyncron workflow to have control over the temporary version of the document.

Parameters
$writer : SetaPDF_Core_Writer_FileInterface
 

_getHashByDocument()

Get the SHA-256 hash by a document instance.

Parameters
$document : SetaPDF_Core_Document
 
Exceptions

Throws SetaPDF_Signer_Exception

destroy()

public SetaPDF_Signer_TmpDocument::destroy (
void
): void

Unlinks the temporary file.

getByteRange()

Get the byte range.

getHashFile()

Create and get the file path to a temporary file that represents the bytes that should be be used for hashing.

getSignatureContentLength()

Get the signature content length.

getWriter()

matchesDocument()

Checks whether the document instance matches this temporary version.

The checks are done by the instance identification of the class instance frist. If this does not match, because of an asyncron workflow the document identifications are compared.

Parameters
$document : SetaPDF_Core_Document
 

save()

Saves the temporary document to a writer instance.

Parameters
$writer : SetaPDF_Core_Writer_WriterInterface
 

setByteRange()

public SetaPDF_Signer_TmpDocument::setByteRange (
array $byteRange
): void

Set the final byte range.

Parameters
$byteRange : array
 

setDocumentIdentification()

Set the document identification related data.

Parameters
$document : SetaPDF_Core_Document
 

setWriter()

Set the writer instance.

Parameters
$writer : SetaPDF_Core_Writer_FileInterface
 

updateIdentificationHash()

Updates the identification hash of the intermediate document version.

updateLastByteOffset()

public SetaPDF_Signer_TmpDocument::updateLastByteOffset (
int $offset, int $position, int $length
): void

Updates the last byte offset in the /ByteRange entry in the to be signed document.

Parameters
$offset : int
 
$position : int
 
$length : int
 

writeSignature()

public SetaPDF_Signer_TmpDocument::writeSignature (
string $signature
): void

Writes the signature into the reserved gap.

The signature string needs to have the same length as the gap.

Parameters
$signature : string