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

File: /SetaPDF/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

$_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 void SetaPDF_Signer_TmpDocument::destroy ( 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 void SetaPDF_Signer_TmpDocument::setByteRange ( array $byteRange )

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
 

updateLastByteOffset()

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

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

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

writeSignature()

public void SetaPDF_Signer_TmpDocument::writeSignature ( string $signature )

Writes the signature into the reserved gap.

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

Parameters
$signature : string