File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,7 +144,12 @@ private function signWrapper(JSignPDF $jSignPDF): string {
144144 $ param
145145 ->setJSignParameters (
146146 $ this ->jSignParam ->getJSignParameters () .
147- ' --hash-algorithm ' . $ this ->getHashAlgorithm ()
147+ ' --hash-algorithm ' . $ this ->getHashAlgorithm () .
148+ (
149+ $ this ->getReason ()
150+ ? ' --reason " ' . $ this ->getReason () . '" '
151+ : ''
152+ )
148153 );
149154 $ jSignPDF ->setParam ($ param );
150155 return $ jSignPDF ->sign ();
Original file line number Diff line number Diff line change @@ -423,6 +423,7 @@ public function sign(): File {
423423 ->setInputFile ($ this ->getInputFile ())
424424 ->setPassword ($ this ->getPassword ())
425425 ->setVisibleElements ($ this ->getvisibleElements ())
426+ ->setReason ($ this ->getReason ())
426427 ->sign ();
427428 $ this ->getInputFile ()->putContent ($ signedContent );
428429 return $ this ->getInputFile ();
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ abstract class SignEngineHandler implements ISignEngineHandler {
1515 private File $ inputFile ;
1616 private string $ certificate ;
1717 private string $ password = '' ;
18+ private string $ reason = '' ;
1819 /** @var VisibleElementAssoc[] */
1920 private array $ visibleElements = [];
2021
@@ -54,6 +55,15 @@ public function getPassword(): string {
5455 return $ this ->password ;
5556 }
5657
58+ public function setReason (string $ reason ): self {
59+ $ this ->reason = $ reason ;
60+ return $ this ;
61+ }
62+
63+ public function getReason (): string {
64+ return $ this ->reason ;
65+ }
66+
5767 /**
5868 * @param VisibleElementAssoc[] $visibleElements
5969 *
Original file line number Diff line number Diff line change @@ -266,6 +266,9 @@ public function sign(): File {
266266 ->setCertificate ($ pfxFileContent )
267267 ->setVisibleElements ($ this ->elements )
268268 ->setPassword ($ this ->password )
269+ ->setReason ($ this ->l10n ->t ('Signed by %s with LibreSign.coop ' , [
270+ $ this ->signRequest ->getDisplayName () . ' < ' . $ this ->userUniqueIdentifier . '> '
271+ ]))
269272 ->sign ();
270273 break ;
271274 default :
You can’t perform that action at this time.
0 commit comments