File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,7 +111,8 @@ private function commandSign(JSignParam $params)
111111 }
112112 $ this ->throwIf (!file_exists ($ jSignPdf ), 'Jar of JSignPDF not found on path: ' . $ jSignPdf );
113113
114- return "$ java -jar $ jSignPdf $ pdf -ksf $ certificate -ksp ' {$ params ->getPassword ()}' {$ params ->getJSignParameters ()} -d {$ params ->getPathPdfSigned ()} 2>&1 " ;
114+ $ password = escapeshellarg ($ params ->getPassword ());
115+ return "$ java -jar $ jSignPdf $ pdf -ksf $ certificate -ksp {$ password } {$ params ->getJSignParameters ()} -d {$ params ->getPathPdfSigned ()} 2>&1 " ;
115116 }
116117
117118 private function javaCommand (JSignParam $ params )
Original file line number Diff line number Diff line change @@ -67,6 +67,19 @@ public function testSignSuccess()
6767 $ this ->assertNotNull ($ fileSigned );
6868 }
6969
70+ public function testSignUsingPasswordWithQuote ()
71+ {
72+ if (!class_exists ('JSignPDF\JSignPDFBin\JavaCommandService ' )) {
73+ $ this ->markTestSkipped ('Install jsignpdf/jsignpdf-bin ' );
74+ }
75+ $ params = JSignParamBuilder::instance ()->withDefault ();
76+ $ password = "with ' quote " ;
77+ $ params ->setCertificate ($ this ->getNewCert ($ password ));
78+ $ params ->setPassword ($ password );
79+ $ fileSigned = $ this ->service ->sign ($ params );
80+ $ this ->assertNotNull ($ fileSigned );
81+ }
82+
7083 public function testCertificateExpired ()
7184 {
7285 if (!class_exists ('JSignPDF\JSignPDFBin\JavaCommandService ' )) {
You can’t perform that action at this time.
0 commit comments