aboutsummaryrefslogtreecommitdiffstats
path: root/demo
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-31 17:44:35 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-31 17:44:35 +0200
commitf3beb1624c24012c246d17a40c4e10c1c6b3b5b5 (patch)
tree93430f34b957a6d5037157913605c0ccbba79856 /demo
parent6816fc573608cf9a5783caeabd47b8dbe1ac5ac5 (diff)
downloadBobinkQtOpcUa-f3beb1624c24012c246d17a40c4e10c1c6b3b5b5.tar.gz
BobinkQtOpcUa-f3beb1624c24012c246d17a40c4e10c1c6b3b5b5.zip
Add passphrase-protected private key support
Wire up QOpcUaClient::passwordForPrivateKeyRequired to a QML dialog, mirroring the existing certificate trust flow (local QEventLoop + 30s timeout).
Diffstat (limited to 'demo')
-rw-r--r--demo/CMakeLists.txt1
-rw-r--r--demo/KeyPasswordDialog.qml53
-rw-r--r--demo/Main.qml12
3 files changed, 66 insertions, 0 deletions
diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt
index 96dade8..ca39de8 100644
--- a/demo/CMakeLists.txt
+++ b/demo/CMakeLists.txt
@@ -9,6 +9,7 @@ qt_add_qml_module(
QML_FILES
Main.qml
CertTrustDialog.qml
+ KeyPasswordDialog.qml
ConnectionPage.qml
DebugConsole.qml
NodePage.qml
diff --git a/demo/KeyPasswordDialog.qml b/demo/KeyPasswordDialog.qml
new file mode 100644
index 0000000..4bf094c
--- /dev/null
+++ b/demo/KeyPasswordDialog.qml
@@ -0,0 +1,53 @@
+// KeyPasswordDialog.qml — Modal dialog for encrypted private-key passphrase.
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import Bobink
+
+Dialog {
+ id: keyPasswordDialog
+
+ property string keyFilePath
+ property bool previousTryWasInvalid: false
+
+ anchors.centerIn: parent
+ implicitWidth: 400
+ modal: true
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ title: "Private Key Password"
+
+ onAccepted: Bobink.provideKeyPassword(passwordField.text)
+ onOpened: {
+ passwordField.text = "";
+ passwordField.forceActiveFocus();
+ }
+ onRejected: Bobink.cancelKeyPassword()
+
+ ColumnLayout {
+ width: parent.width
+
+ Label {
+ Layout.fillWidth: true
+ text: "Enter the password for:\n" + keyPasswordDialog.keyFilePath
+ wrapMode: Text.Wrap
+ }
+
+ Label {
+ Layout.fillWidth: true
+ color: "red"
+ text: "Invalid password, please try again."
+ visible: keyPasswordDialog.previousTryWasInvalid
+ }
+
+ TextField {
+ id: passwordField
+
+ Layout.fillWidth: true
+ echoMode: TextInput.Password
+ placeholderText: "Password"
+
+ onAccepted: keyPasswordDialog.accept()
+ }
+ }
+}
diff --git a/demo/Main.qml b/demo/Main.qml
index 908dcbd..f0f3674 100644
--- a/demo/Main.qml
+++ b/demo/Main.qml
@@ -44,6 +44,13 @@ ApplicationWindow {
debugConsole.appendLog("Discovering: " + Bobink.discovering);
}
+ function onPrivateKeyPasswordRequired(keyFilePath,
+ previousTryWasInvalid) {
+ keyPasswordDialog.keyFilePath = keyFilePath;
+ keyPasswordDialog.previousTryWasInvalid = previousTryWasInvalid;
+ keyPasswordDialog.open();
+ }
+
function onServersChanged() {
debugConsole.appendLog("Discovered server list updated");
}
@@ -60,6 +67,11 @@ ApplicationWindow {
}
+ KeyPasswordDialog {
+ id: keyPasswordDialog
+
+ }
+
ColumnLayout {
anchors.fill: parent
spacing: 0