diff --git a/lib/Handler/JSignPdfHandler.php b/lib/Handler/JSignPdfHandler.php
index 37af5c660e..c140ae3cfb 100644
--- a/lib/Handler/JSignPdfHandler.php
+++ b/lib/Handler/JSignPdfHandler.php
@@ -54,6 +54,10 @@ public function getJSignParam(): JSignParam {
->setjSignPdfJarPath(
$this->appConfig->getAppValue('jsignpdf_jar_path', '/opt/jsignpdf-' . self::VERSION . '/JSignPdf.jar')
);
+ $parameters = $this->jSignParam->getJSignParameters();
+ $parameters .= ' --hash-algorithm ' . $this->getHashAlgorithm();
+ $parameters = trim($parameters);
+ $this->jSignParam->setJSignParameters($parameters);
if (!empty($javaPath)) {
if (!file_exists($javaPath)) {
throw new \Exception('Invalid Java binary. Run occ libresign:install --java');
@@ -64,6 +68,14 @@ public function getJSignParam(): JSignParam {
return $this->jSignParam;
}
+ private function getHashAlgorithm(): string {
+ $hashAlgorithm = $this->appConfig->getAppValue('signature_hash_algorithm', 'SHA256');
+ if (in_array($hashAlgorithm, ['SHA1', 'SHA256', 'SHA384', 'SHA512', 'RIPEMD160'])) {
+ return $hashAlgorithm;
+ }
+ return 'SHA256';
+ }
+
/**
* @psalm-suppress MixedReturnStatement
*/
diff --git a/src/views/Settings/Settings.vue b/src/views/Settings/Settings.vue
index e6da9e1228..e38ade0f66 100644
--- a/src/views/Settings/Settings.vue
+++ b/src/views/Settings/Settings.vue
@@ -18,6 +18,7 @@
+
@@ -36,6 +37,7 @@ import IdentificationFactors from './IdentificationFactors.vue'
import LegalInformation from './LegalInformation.vue'
import RootCertificateCfssl from './RootCertificateCfssl.vue'
import RootCertificateOpenSsl from './RootCertificateOpenSsl.vue'
+import SignatureHashAlgorithm from './SignatureHashAlgorithm.vue'
import Validation from './Validation.vue'
export default {
@@ -55,6 +57,7 @@ export default {
IdentificationDocuments,
CollectMetadata,
DefaultUserFolder,
+ SignatureHashAlgorithm,
},
data() {
return {
diff --git a/src/views/Settings/SignatureHashAlgorithm.vue b/src/views/Settings/SignatureHashAlgorithm.vue
new file mode 100644
index 0000000000..baed98edd4
--- /dev/null
+++ b/src/views/Settings/SignatureHashAlgorithm.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+