Skip to content

Commit 9bc1def

Browse files
committed
fix: handle null return from ASN1::decodeBER in Pkcs12Handler
Signed-off-by: Clément Christiaens <clement.christiaens@xwiki.com>
1 parent 2413e7a commit 9bc1def

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Handler/SignEngine/Pkcs12Handler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function processSignature($resource, ?string $signature): array {
117117
return $result;
118118
}
119119

120-
$decoded = ASN1::decodeBER($signature);
120+
$decoded = ASN1::decodeBER($signature) ?? [];
121121
$result = $this->extractTimestampData($decoded, $result);
122122

123123
$chain = $this->extractCertificateChain($signature);
@@ -163,6 +163,10 @@ private function extractDocMdpData($resource, array $result): array {
163163
}
164164

165165
private function extractTimestampData(array $decoded, array $result): array {
166+
if (empty($decoded)) {
167+
return $result;
168+
}
169+
166170
$tsa = new TSA();
167171

168172
try {

0 commit comments

Comments
 (0)