diff --git a/app.php b/app.php index d7a7bfc..45cd806 100644 --- a/app.php +++ b/app.php @@ -83,7 +83,11 @@ $f3->route('GET /signature', } if (!$f3->exists('PDF_STORAGE_ENCRYPTION')) { - $f3->set('PDF_STORAGE_ENCRYPTION', ''); + if (CryptographyClass::isGpgInstalled() == true) { + $f3->set('PDF_STORAGE_ENCRYPTION', 'true'); + } else { + $f3->set('PDF_STORAGE_ENCRYPTION', ''); + } } $f3->set('activeTab', 'sign'); diff --git a/lib/cryptography.class.php b/lib/cryptography.class.php index 7081f80..ce19de8 100644 --- a/lib/cryptography.class.php +++ b/lib/cryptography.class.php @@ -74,5 +74,17 @@ class CryptographyClass return implode('', $pieces); } + + public static function isGpgInstalled() { + $output = null; + $returnCode = null; + + exec('gpg --version', $output, $returnCode); + + if ($returnCode == 0) { + return true; + } + return false; + } } ?>