Skip to content

Commit 23d558f

Browse files
committed
Make adding of revocation info optional.
1 parent 41d9b5f commit 23d558f

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/SignatureModule.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ class SignatureModule implements
3131
*/
3232
protected $identity;
3333

34+
/**
35+
* @var bool
36+
*/
37+
protected $addRevocationInfo = true;
38+
3439
/**
3540
* The constructor.
3641
*
@@ -63,6 +68,16 @@ public function getCertificate(): string
6368
return $this->identity->getSigningCertificate();
6469
}
6570

71+
/**
72+
* Define whether to add revocation information to the CMS container or not (default = true).
73+
*
74+
* @param bool $addRevocationInfo
75+
*/
76+
public function setAddRevocationInfo($addRevocationInfo)
77+
{
78+
$this->addRevocationInfo = (bool)$addRevocationInfo;
79+
}
80+
6681
/**
6782
* Create a signature for the file in the given $tmpPath.
6883
*
@@ -77,9 +92,11 @@ public function createSignature(\SetaPDF_Core_Reader_FilePath $tmpPath): string
7792
$trustChain = $this->client->getTrustchain();
7893
$this->module->setExtraCertificates($trustChain->trustchain);
7994

80-
$this->module->addOcspResponse(\base64_decode($this->identity->getOcspResponse()));
81-
foreach ($trustChain->ocsp_revocation_info as $ocspRevocationInfo) {
82-
$this->module->addOcspResponse(\base64_decode($ocspRevocationInfo));
95+
if ($this->addRevocationInfo) {
96+
$this->module->addOcspResponse(\base64_decode($this->identity->getOcspResponse()));
97+
foreach ($trustChain->ocsp_revocation_info as $ocspRevocationInfo) {
98+
$this->module->addOcspResponse(\base64_decode($ocspRevocationInfo));
99+
}
83100
}
84101

85102
$hash = \hash('sha256', $this->module->getDataToSign($tmpPath));

tests/functional/ClientTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testWithoutNoClientCertificates(): void
2020

2121
/**
2222
* @expectedException \GuzzleHttp\Exception\ClientException
23-
* @expectedExceptionMessage 422 Unprocessable Entity
23+
* @expectedExceptionMessage 400 Bad Request
2424
*/
2525
public function testFailedLogin()
2626
{

0 commit comments

Comments
 (0)