SetaPDF_Signer_Signature_Module_OpenSsl A signature module which uses the PHP builtin openssl functions.

File: /SetaPDF v2/Signer/Signature/Module/OpenSsl.php

This module make use of the function openssl_pkcs7_sign() to create the signature.

Class hierarchy

Implements

Summary

Properties

$_certificate

$_extraCertificates

The path to a file containing bunch of extra certificates to include in the signature

$_fp

File pointer for the signed message

$_outPath

A temporary path of the signed message

$_privateKey


Methods

__construct()

The constructor.

Exceptions

Throws SetaPDF_Signer_Exception

_cleanUp()

Close file handles and remove temporary files if needed.

createSignature()

Create the signature.

This method creates a digital signature for the file available in $tmpPath and returns it in binary format.

Parameters
$tmpPath : SetaPDF_Core_Reader_FilePath
 
Exceptions

Throws SetaPDF_Signer_Exception

Throws InvalidArgumentException if the $tmpPath isn't readable

getCertificate()

Get the certificate parameter.

getExtraCertificates()

Get the extra certificate parameter.

getPrivateKey()

Get the private key parameter

setCertificate()

public SetaPDF_Signer_Signature_Module_OpenSsl::setCertificate (
mixed $certificate
): void

Set the certificate parameter.

This module make use of the build in openssl functions. So the certificate parameter has to be passed as defined here: http://php.net/openssl.certparams.

Some examples:

$module->setCertificate(file_get_contents('path/to/certificate.pem'));
// or
$module->setCertificate('file://path/to/certificate.pem');

Notice the "file://" prefix if you need to pass the certificate path instead of its content.

Parameters
$certificate : mixed
 

setExtraCertificates()

public SetaPDF_Signer_Signature_Module_OpenSsl::setExtraCertificates (
string $extraCertificates
): void

Set the extra certificate parameter.

This parameter specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.

If the certificates are saved in separate files, you will need to assemble them in one single file. Just copy them with a text editor one after another.

Parameters
$extraCertificates : string
 

setPrivateKey()

public SetaPDF_Signer_Signature_Module_OpenSsl::setPrivateKey (
mixed $privateKey
): void

Set the private key parameter.

This module make use of the build in openssl functions. So the private key parameter has to be passed as defined here: http://php.net/openssl.certparams.

Parameters
$privateKey : mixed