diff --git a/src/lib/gui/tls/TlsUtility.cpp b/src/lib/gui/tls/TlsUtility.cpp index 1249a1368..09f14606d 100644 --- a/src/lib/gui/tls/TlsUtility.cpp +++ b/src/lib/gui/tls/TlsUtility.cpp @@ -15,82 +15,77 @@ #include #include -namespace deskflow::gui { +namespace deskflow::gui::TlsUtility { -TlsUtility::TlsUtility(QObject *parent) : QObject(parent) -{ - // do nothing -} - -bool TlsUtility::isEnabled() +bool isEnabled() { return Settings::value(Settings::Security::TlsEnabled).toBool(); } -bool TlsUtility::isCertValid(const QString &certPath) +bool isCertValid(const QString &certPath) { const auto certs = QSslCertificate::fromPath(certPath); if (certs.isEmpty()) { //: %1 will be replaced by the certificate path - qDebug() << tr("failed to read key from certificate file: %1").arg(certPath); + qDebug() << QObject::tr("failed to read key from certificate file: %1").arg(certPath); return false; } const auto cert = certs.first(); if (cert.isNull()) { //: %1 will be replaced by the certificate path - qDebug() << tr("failed to parse certificate file: %1").arg(certPath); + qDebug() << QObject::tr("failed to parse certificate file: %1").arg(certPath); return false; } const auto key = cert.publicKey(); if (key.isNull()) { //: %1 will be replaced by the certificate path - qDebug() << tr("failed to read key from certificate file: %1").arg(certPath); + qDebug() << QObject::tr("failed to read key from certificate file: %1").arg(certPath); return false; } if (key.length() != Settings::value(Settings::Security::KeySize).toInt()) { - qDebug() << tr("key detected is the incorrect size"); + qDebug() << QObject::tr("key detected is the incorrect size"); return false; } if (const auto type = key.algorithm(); (type != QSsl::Dsa || type != QSsl::Rsa)) { //: %1 will be replaced by the certificate path - qDebug() << tr("failed to read RSA or DSA key from certificate file: %1").arg(certPath); + qDebug() << QObject::tr("failed to read RSA or DSA key from certificate file: %1").arg(certPath); return false; } return true; } -int TlsUtility::getCertKeyLength(const QString &certPath) +int getCertKeyLength(const QString &certPath) { return deskflow::getCertLength(certPath.toStdString()); } -QByteArray TlsUtility::certFingerprint(const QString &certPath) +QByteArray certFingerprint(const QString &certPath) { QByteArray fingerprint; const auto certs = QSslCertificate::fromPath(certPath); if (certs.isEmpty()) { //: %1 will be replaced by the certificate path - qDebug() << tr("failed to read key from certificate file: %1").arg(certPath); + qDebug() << QObject::tr("failed to read key from certificate file: %1").arg(certPath); return fingerprint; } const auto cert = certs.first(); if (cert.isNull()) { //: %1 will be replaced by the certificate path - qWarning() << tr("failed to parse certificate file: %1").arg(certPath); + qWarning() << QObject::tr("failed to parse certificate file: %1").arg(certPath); return fingerprint; } return cert.digest(QCryptographicHash::Sha256); } -bool TlsUtility::generateCertificate() +bool generateCertificate() { qDebug( "generating tls certificate, " @@ -116,4 +111,4 @@ bool TlsUtility::generateCertificate() return true; } -} // namespace deskflow::gui +} // namespace deskflow::gui::TlsUtility diff --git a/src/lib/gui/tls/TlsUtility.h b/src/lib/gui/tls/TlsUtility.h index 4b3e70703..b9d7c7ded 100644 --- a/src/lib/gui/tls/TlsUtility.h +++ b/src/lib/gui/tls/TlsUtility.h @@ -9,47 +9,36 @@ #include -#include +namespace deskflow::gui::TlsUtility { -namespace deskflow::gui { +bool generateCertificate(); -class TlsUtility : public QObject -{ - Q_OBJECT +/** + * @brief Checks the settings values Settings::Security::TlsEnabled + * @return true when tls is enabled + */ +bool isEnabled(); -public: - explicit TlsUtility(QObject *parent = nullptr); +/** + * @brief isCertValid + * @param certPath the path of the file to check, when not set uses Settings::Security::Certificate value + * @return true if the certificate is valid + */ +bool isCertValid(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); - static bool generateCertificate(); +/** + * @brief Get the lenght of a key + * @param certPath path of the file to check, when unset will use the value of Settings::Security::Certificate + * @return the bitsize of the key + */ +int getCertKeyLength(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); - /** - * @brief Checks the settings values Settings::Security::TlsEnabled - * @return true when tls is enabled - */ - static bool isEnabled(); - - /** - * @brief isCertValid - * @param certPath the path of the file to check, when not set uses Settings::Security::Certificate value - * @return true if the certificate is valid - */ - static bool isCertValid(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); - - /** - * @brief Get the lenght of a key - * @param certPath path of the file to check, when unset will use the value of Settings::Security::Certificate - * @return the bitsize of the key - */ - static int getCertKeyLength(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); - - /** - * @brief get the SHA256 fingerprint of a certificatefile. - * @param certPath path of the file to fingerprint, when not set uses the vaule of Settings::Security::Certificate - * @return A QByteArray of the SHA256 fingerprint of the file or empty array if invalid file is passed - */ - // clang-format off - static QByteArray certFingerprint(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); - // clang-format on -}; - -} // namespace deskflow::gui +/** + * @brief get the SHA256 fingerprint of a certificatefile. + * @param certPath path of the file to fingerprint, when not set uses the vaule of Settings::Security::Certificate + * @return A QByteArray of the SHA256 fingerprint of the file or empty array if invalid file is passed + */ +// clang-format off + QByteArray certFingerprint(const QString &certPath = Settings::value(Settings::Security::Certificate).toString()); +// clang-format on +} // namespace deskflow::gui::TlsUtility diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index 525127de2..f261eeab4 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -711,6 +711,25 @@ Nombres válidos: <p>There was a problem finding the %1 background service (daemon).</p><p>The background service makes %1 work with UAC prompts and the login screen.</p><p>If don't want to use the background service and intentionally stopped it, you can prevent it's use by disabling this feature.</p><p>If you did not stop the background service intentionally, there may be a problem with it. Please retry or try restarting the %1 service from the Windows services program.</p> <p>Hubo un problema al encontrar el servicio en segundo plano %1 (daemon).</p><p>El servicio en segundo plano hace que %1 funcione con los avisos de UAC y la pantalla de inicio de sesión.</p><p>Si no desea usar el servicio en segundo plano y lo detuvo intencionalmente, puede evitar su uso deshabilitando esta función.</p><p>Si no detuvo el servicio en segundo plano intencionalmente, es posible que haya un problema. Vuelva a intentarlo o reinicie el servicio %1 desde el programa de servicios de Windows.</p> + + failed to read key from certificate file: %1 + %1 will be replaced by the certificate path + No se pudo leer la clave del archivo de certificado: %1 + + + failed to parse certificate file: %1 + %1 will be replaced by the certificate path + Error al analizar el archivo de certificado: %1 + + + key detected is the incorrect size + La clave detectada es de tamaño incorrecto + + + failed to read RSA or DSA key from certificate file: %1 + %1 will be replaced by the certificate path + No se pudo leer la clave RSA o DSA del archivo de certificado: %1 + ScreenSettingsDialog @@ -1265,28 +1284,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU <html><head/><body><p>Requiere el paquete wl-clipboard</p><p>Al usar wl-clipboard v2.2.1, existe un error que provoca la pérdida del foco y que puede dificultar el uso de Deskflow. Este error se ha corregido al usar la rama principal de wl-clipboard, a menos que su Compositor no sea compatible con el protocolo wlroots-data-control.</p></body></html> - - deskflow::gui::TlsUtility - - failed to parse certificate file: %1 - %1 will be replaced by the certificate path - Error al analizar el archivo de certificado: %1 - - - failed to read key from certificate file: %1 - %1 will be replaced by the certificate path - No se pudo leer la clave del archivo de certificado: %1 - - - key detected is the incorrect size - La clave detectada es de tamaño incorrecto - - - failed to read RSA or DSA key from certificate file: %1 - %1 will be replaced by the certificate path - No se pudo leer la clave RSA o DSA del archivo de certificado: %1 - - i18n diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index 0f0c468cb..9c5e0d18f 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -711,6 +711,25 @@ Nomi validi: <p>There was a problem finding the %1 background service (daemon).</p><p>The background service makes %1 work with UAC prompts and the login screen.</p><p>If don't want to use the background service and intentionally stopped it, you can prevent it's use by disabling this feature.</p><p>If you did not stop the background service intentionally, there may be a problem with it. Please retry or try restarting the %1 service from the Windows services program.</p> <p>Si è verificato un problema durante la ricerca del servizio in background %1 (daemon).</p><p>Il servizio in background consente a %1 di funzionare con i prompt UAC e la schermata di accesso.</p><p>Se non desideri utilizzare il servizio in background e lo hai interrotto intenzionalmente, puoi impedirne l'uso disabilitando questa funzionalità.</p><p>Se non hai interrotto intenzionalmente il servizio in background, potrebbe esserci un problema. Riprova o prova a riavviare il servizio %1 dal programma dei servizi di Windows.</p> + + failed to read key from certificate file: %1 + %1 will be replaced by the certificate path + impossibile leggere la chiave dal file del certificato: %1 + + + failed to parse certificate file: %1 + %1 will be replaced by the certificate path + impossibile analizzare il file del certificato: %1 + + + key detected is the incorrect size + la chiave rilevata ha una dimensione errata + + + failed to read RSA or DSA key from certificate file: %1 + %1 will be replaced by the certificate path + impossibile leggere la chiave RSA o DSA dal file del certificato: %1 + ScreenSettingsDialog @@ -1265,28 +1284,6 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf <html><head/><body><p>Richiede il pacchetto wl-clipboard</p><p>Quando si utilizza wl-clipboard v2.2.1, si verifica un bug di furto del focus che potrebbe rendere Deskflow più difficile da usare. Questo problema è stato risolto quando si utilizza il ramo master di wl-clipboard, a meno che il proprio compositore non supporti il ​​protocollo wlroots-data-control.</p></body></html> - - deskflow::gui::TlsUtility - - failed to parse certificate file: %1 - %1 will be replaced by the certificate path - impossibile analizzare il file del certificato: %1 - - - failed to read key from certificate file: %1 - %1 will be replaced by the certificate path - impossibile leggere la chiave dal file del certificato: %1 - - - key detected is the incorrect size - la chiave rilevata ha una dimensione errata - - - failed to read RSA or DSA key from certificate file: %1 - %1 will be replaced by the certificate path - impossibile leggere la chiave RSA o DSA dal file del certificato: %1 - - i18n diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index f1040aeba..700f040e5 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -712,6 +712,25 @@ Valid names: <p>There was a problem finding the %1 background service (daemon).</p><p>The background service makes %1 work with UAC prompts and the login screen.</p><p>If don't want to use the background service and intentionally stopped it, you can prevent it's use by disabling this feature.</p><p>If you did not stop the background service intentionally, there may be a problem with it. Please retry or try restarting the %1 service from the Windows services program.</p> <p>%1 バックグラウンドサービス(デーモン)が検出できませんでした。</p><p>バックグラウンドサービスは %1 がUACプロンプトとログイン画面で動作するために必要です。</p><p>もしバックグラウンドサービスが不要で意図的に停止したのであれば、この機能を無効化することで利用を止めることができます。</p><p>もし意図的に止めたのでなければ、何か問題があるかもしれません。再試行するか、%1 サービスをWindowsのサービス設定から再起動してみてください。</p> + + failed to read key from certificate file: %1 + %1 will be replaced by the certificate path + 証明書ファイルからキーを読み取ることができませんでした: %1 + + + failed to parse certificate file: %1 + %1 will be replaced by the certificate path + 証明書ファイルの解析に失敗しました: %1 + + + key detected is the incorrect size + 検出されたキーのサイズが正しくありません + + + failed to read RSA or DSA key from certificate file: %1 + %1 will be replaced by the certificate path + 証明書ファイルから RSA または DSA キーを読み取ることができませんでした: %1 + ScreenSettingsDialog @@ -1266,28 +1285,6 @@ Enabling this setting will disable the server config GUI. <html><head/><body><p>wl-clipboard パッケージが必要です。</p><p>wl-clipboard v2.2.1 を使用すると、フォーカス盗用のバグにより Deskflow の使い勝手が悪くなる可能性があります。この問題は wl-clipboard のマスターブランチで修正されていますが、使用しているコンポジターが wlroots-data-control プロトコルに対応している必要があります。</p></body></html> - - deskflow::gui::TlsUtility - - failed to parse certificate file: %1 - %1 will be replaced by the certificate path - 証明書ファイルの解析に失敗しました: %1 - - - failed to read key from certificate file: %1 - %1 will be replaced by the certificate path - 証明書ファイルからキーを読み取ることができませんでした: %1 - - - key detected is the incorrect size - 検出されたキーのサイズが正しくありません - - - failed to read RSA or DSA key from certificate file: %1 - %1 will be replaced by the certificate path - 証明書ファイルから RSA または DSA キーを読み取ることができませんでした: %1 - - i18n diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index 9b98de844..7875ec4cd 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -714,6 +714,25 @@ Valid names: <p>There was a problem finding the %1 background service (daemon).</p><p>The background service makes %1 work with UAC prompts and the login screen.</p><p>If don't want to use the background service and intentionally stopped it, you can prevent it's use by disabling this feature.</p><p>If you did not stop the background service intentionally, there may be a problem with it. Please retry or try restarting the %1 service from the Windows services program.</p> <p>Возникла проблема нахождения %1 фоновым процессом (daemon).</p><p>Сервис %1 работает с UAC промтом и экраном входа.</p><p>Если Вы не хотите использовать сервис в фоновом режиме и намеренно останавливать его, Вы можете предотвратить его использование после отключения опции.</p><p>Если Вы не останавливали сервис намеренно, проблема может заключаться нем. Попробуйте перезапустить сервис %1 из программы Windows services.</p> + + failed to read key from certificate file: %1 + %1 will be replaced by the certificate path + не удалось прочитать ключ из файла сертификата: %1 + + + failed to parse certificate file: %1 + %1 will be replaced by the certificate path + не удалось проанализировать файл сертификата: %1 + + + key detected is the incorrect size + обнаружен ключ неправильного размера + + + failed to read RSA or DSA key from certificate file: %1 + %1 will be replaced by the certificate path + не удалось прочитать ключ RSA или DSA из файла сертификата: %1 + ScreenSettingsDialog @@ -1270,28 +1289,6 @@ Enabling this setting will disable the server config GUI. <html><head/><body><p>Для этого необходим пакет wl-clipboard.</p><p>Когда ты используешь wl-clipboard v2.2.1. Возникает ошибка перехвата фокуса, которая мешает использовать deskflowю. Это фиксется если использовать wl-clipboard из ветки master, если только ваш Compositor не поддерживает протокол wlroots-data-control.</p></body></html> - - deskflow::gui::TlsUtility - - failed to parse certificate file: %1 - %1 will be replaced by the certificate path - не удалось проанализировать файл сертификата: %1 - - - failed to read key from certificate file: %1 - %1 will be replaced by the certificate path - не удалось прочитать ключ из файла сертификата: %1 - - - key detected is the incorrect size - обнаружен ключ неправильного размера - - - failed to read RSA or DSA key from certificate file: %1 - %1 will be replaced by the certificate path - не удалось прочитать ключ RSA или DSA из файла сертификата: %1 - - i18n diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index db30930fb..a8982c48e 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -712,6 +712,25 @@ Valid names: <p>There was a problem finding the %1 background service (daemon).</p><p>The background service makes %1 work with UAC prompts and the login screen.</p><p>If don't want to use the background service and intentionally stopped it, you can prevent it's use by disabling this feature.</p><p>If you did not stop the background service intentionally, there may be a problem with it. Please retry or try restarting the %1 service from the Windows services program.</p> <p>查找 %1 后台服务(守护进程)时出现问题。</p><p>%1 需后台服务来与 UAC 提示和登录屏幕配合工作。</p><p>如果您不想使用后台服务并已将其停止,可以通过禁用此功能来阻止使用它。</p><p>如果您并非有意停止后台服务,则可能存在问题。请重试,或尝试从 Windows 服务程序中重启 %1 服务。</p> + + failed to read key from certificate file: %1 + %1 will be replaced by the certificate path + 无法从证书文件中读取密钥:%1 + + + failed to parse certificate file: %1 + %1 will be replaced by the certificate path + 解析证书文件失败:%1 + + + key detected is the incorrect size + 检测到的密钥大小不正确。 + + + failed to read RSA or DSA key from certificate file: %1 + %1 will be replaced by the certificate path + 无法从证书文件中读取 RSA 或 DSA 密钥:%1 + ScreenSettingsDialog @@ -1266,28 +1285,6 @@ Enabling this setting will disable the server config GUI. <html><head/><body><p>需要 wl-clipboard 包</p><p>使用 wl-clipboard v2.2.1 时存在一个焦点抢夺 Bug,可能导致 Deskflow 使用不便。该问题已在 wl-clipboard 的 master 分支中修复,除非您的合成器不支持 wlroots-data-control 协议。</p></body></html> - - deskflow::gui::TlsUtility - - failed to parse certificate file: %1 - %1 will be replaced by the certificate path - 解析证书文件失败:%1 - - - failed to read key from certificate file: %1 - %1 will be replaced by the certificate path - 无法从证书文件中读取密钥:%1 - - - key detected is the incorrect size - 检测到的密钥大小不正确。 - - - failed to read RSA or DSA key from certificate file: %1 - %1 will be replaced by the certificate path - 无法从证书文件中读取 RSA 或 DSA 密钥:%1 - - i18n