File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -564,6 +564,30 @@ describe("signing integration", () => {
564564 const pdfStr = new TextDecoder ( ) . decode ( bytes ) ;
565565 expect ( pdfStr ) . toContain ( "/SubFilter /adbe.pkcs7.detached" ) ;
566566 } ) ;
567+
568+ it ( "handles buildChain with self-signed ECDSA cert" , async ( ) => {
569+ const p12Bytes = await loadFixture ( "certificates" , P12_FILES . ecdsaP256 ) ;
570+
571+ // Self-signed cert has no AIA URLs, so buildChain should gracefully handle this
572+ const signer = await P12Signer . create ( p12Bytes , "test123" , { buildChain : true } ) ;
573+
574+ expect ( signer . certificate ) . toBeInstanceOf ( Uint8Array ) ;
575+ expect ( signer . certificateChain ) . toHaveLength ( 0 ) ; // Self-signed has no chain
576+
577+ // Should still sign successfully
578+ const pdfBytes = await loadFixture ( "basic" , "rot0.pdf" ) ;
579+ const pdf = await PDF . load ( pdfBytes ) ;
580+
581+ const { bytes, warnings } = await pdf . sign ( {
582+ signer,
583+ reason : "Self-signed ECDSA with buildChain" ,
584+ } ) ;
585+
586+ expect ( warnings ) . toHaveLength ( 0 ) ;
587+ expect ( bytes . length ) . toBeGreaterThan ( pdfBytes . length ) ;
588+
589+ await saveTestOutput ( "signatures/signed-ecdsa-p256-buildchain.pdf" , bytes ) ;
590+ } ) ;
567591 } ) ;
568592
569593 describe ( "error handling" , ( ) => {
You can’t perform that action at this time.
0 commit comments