Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DSS
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
1 / 1
 toPdf
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
5
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Document;
6
7use Phpdftk\Pdf\Core\PdfArray;
8use Phpdftk\Pdf\Core\PdfDictionary;
9use Phpdftk\Pdf\Core\PdfObject;
10use Phpdftk\Pdf\Core\PdfReference;
11use Phpdftk\Pdf\Core\PdfVersion;
12use Phpdftk\Pdf\Core\RequiresPdfVersion;
13
14/**
15 * Document security store — ISO 32000-2 §12.8.4.3.
16 *
17 * Holds the validation-related information (VRI) used by PAdES LTV
18 * signatures: revocation checks (OCSPs, CRLs) and the certificate chain
19 * required to independently verify a signature long after signing time.
20 *
21 * Referenced from `Catalog::$dss`.
22 */
23#[RequiresPdfVersion(PdfVersion::V2_0)]
24class DSS extends PdfObject
25{
26    public const PDF_TYPE = 'DSS';
27
28    public ?PdfArray $certs = null;       // /Certs  - array of cert streams
29    public ?PdfArray $ocsps = null;       // /OCSPs  - array of OCSP responses
30    public ?PdfArray $crls = null;        // /CRLs   - array of CRL streams
31    public ?PdfDictionary $vri = null;    // /VRI    - validation related info
32
33    public function toPdf(): string
34    {
35        $dict = new PdfDictionary();
36        if ($this->certs !== null) {
37            $dict->set('Certs', $this->certs);
38        }
39        if ($this->ocsps !== null) {
40            $dict->set('OCSPs', $this->ocsps);
41        }
42        if ($this->crls !== null) {
43            $dict->set('CRLs', $this->crls);
44        }
45        if ($this->vri !== null) {
46            $dict->set('VRI', $this->vri);
47        }
48        return $dict->toPdf();
49    }
50}