File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,10 @@ public function getCertificateChain($resource): array {
102102 $ tsa = new TSA ();
103103 $ decoded = ASN1 ::decodeBER ($ signature );
104104 try {
105- $ certificates [$ signerCounter ]['timestamp ' ] = $ tsa ->extract ($ decoded );
105+ $ timestampData = $ tsa ->extract ($ decoded );
106+ if (!empty ($ timestampData ['genTime ' ]) || !empty ($ timestampData ['policy ' ]) || !empty ($ timestampData ['serialNumber ' ])) {
107+ $ certificates [$ signerCounter ]['timestamp ' ] = $ timestampData ;
108+ }
106109 } catch (\Throwable $ e ) {
107110 }
108111
Original file line number Diff line number Diff line change @@ -490,7 +490,9 @@ private function loadSignersFromCertData(): void {
490490 }
491491 if (!empty ($ signer ['timestamp ' ])) {
492492 $ this ->fileData ->signers [$ index ]['timestamp ' ] = $ signer ['timestamp ' ];
493- $ this ->fileData ->signers [$ index ]['timestamp ' ]['genTime ' ] = $ signer ['timestamp ' ]['genTime ' ]->format (DateTimeInterface::ATOM );
493+ if ($ signer ['timestamp ' ]['genTime ' ] instanceof \DateTimeInterface) {
494+ $ this ->fileData ->signers [$ index ]['timestamp ' ]['genTime ' ] = $ signer ['timestamp ' ]['genTime ' ]->format (DateTimeInterface::ATOM );
495+ }
494496 }
495497 for ($ i = 1 ; $ i < count ($ signer ['chain ' ]); $ i ++) {
496498 $ this ->fileData ->signers [$ index ]['chain ' ][] = [
You can’t perform that action at this time.
0 commit comments