From f3beb1624c24012c246d17a40c4e10c1c6b3b5b5 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 31 Mar 2026 17:44:35 +0200 Subject: Add passphrase-protected private key support Wire up QOpcUaClient::passwordForPrivateKeyRequired to a QML dialog, mirroring the existing certificate trust flow (local QEventLoop + 30s timeout). --- demo/KeyPasswordDialog.qml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 demo/KeyPasswordDialog.qml (limited to 'demo/KeyPasswordDialog.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() + } + } +} -- cgit v1.2.3