dealfonso / sapp

Simple and Agnostic PDF Document Parser in PHP - sign PDF docs using PHP
GNU Lesser General Public License v3.0
110 stars 29 forks source link

fix TypeError on all signatures reading #59

Closed erikn69 closed 5 months ago

erikn69 commented 9 months ago

Helps to get signatures count without errors In some signatures openssl_pkcs7_read does not work, TODO: find the real problem

Produces the typeError above: sample01.pdf

https://github.com/dealfonso/sapp/blob/f2ec4b038e5e8d605ed7054d1d9695fa25c388d1/src/PDFDoc.php#L1064-L1074

erikn69 commented 9 months ago

openssl_pkcs7_read works on adbe.pkcs7.detached, but fails on adbe.x509.rsa_sha1/adbe.pkcs7.sha1/ETSI.CAdES.detached, ideas?

<</F 132/Type/Annot/Subtype/Widget/Rect[432 702 612 792]/FT/Sig/DR<</XObject<</FRM 407 0 R>>>>/T(Alice-1-1081652293)/V 405 0 R/P 221 0 R/AP<</N 408 0 R>>>>
endobj
405 0 obj
<</Contents <0481808aa9a2c38c0f75dade06619a9c72103a668b6821272dc9e9aabca09513ff63d2cd4f20cb0bddc6cc02e50f55147a4b6f2211dec9003e09adb9e17225e65976e57d781c4eca24856768dab0dffa57a7a4bdd53fa0cc7b5f67c1ff87215dfd1fc90614c981e14ec89de429dcd00e248b0318dde2026a0d98da1ecc56b252354e6e>
/Type/Sig/SubFilter/adbe.x509.rsa_sha1/Location(Sign Location / city)/Name(Alice)/M(D:20091002001131+05'00')/ByteRange [0 210013 210277 7790 ]                                                         
/Cert(0‚[0‚Ä \nïEìÓ.¯Hà10\r\t*†H†÷\r 0^10\fUAlice10U\nTecxoft10\tUQA1 0\t*†H†÷\r\talice@tecxoft.com10\tUUS0\r090729102132Z\r140729102132Z0^10\fUAlice10U\nTecxoft10\tUQA1 0\t*†H†÷\r\talice@tecxoft.com10\tUUS0Ÿ0\r\t*†H†÷\r  0‰ П!+³g³ÏƒHðSEªµZg¸7Œï§Ä~È­^B×ˁcF\bh‰½Üœ:hYÝÐÆÓÌwîøYÌMÉy"ŏjïȶÚ/箧ÎÖc¡Êñ—÷ö’X"·ñC­{7oD3•‚òÚG”Wžˆ~ºqõgBÍ›íß´"` £ 00\t*†H†÷/\n 0U0\r\t*†H†÷\r  _í\t8øsÁ\nVI;Uù<n[§… Å 4u’ =ö¾V´\r‰=÷Ç%8%Ò\td,ÇGªÑŽÒ®LÎô\n-"!Qøßž;Ù×èŸEbnâæÌF:²d'O­c7DõÙÅÚbÖ^®>pe ïhÇÞR\nÉ°×vÐ<äQMÖïT[á°=…l)
/Filter/Adobe.PPKLite/Reason(This is the trial version, please buy to activate.)/ContactInfo(some contact info...)/R 65541>>

Example: https://github.com/gdelugre/origami/issues/46