summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJannis Voelker <jannis.voelker@basyskom.com>2023-07-28 10:10:16 +0200
committerJannis Völker <jannis.voelker@basyskom.com>2023-07-28 08:49:15 +0000
commit8523c81fbd818ad99e64b975e288ccfe28d0656f (patch)
treea6443bdeb6ca0bcc23ef7754a0029edf7dd9069e /examples
parent6eb647e3190566a15f61e7c66981cf8ac8f0753b (diff)
Modernize the X.509 example and make it more generic
Use 2048 bits for the private key. Only the Unified Automation plugin supports private keys with password. So the example should create a key that can be used by both plugins by default. Change-Id: Ia46b345ff0666ae6dcf17a698934e6fb1ff7cce7 Pick-to: 6.5 Pick-to: 6.6 Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/opcua/x509/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/opcua/x509/main.cpp b/examples/opcua/x509/main.cpp
index be42caf..eb421f4 100644
--- a/examples/opcua/x509/main.cpp
+++ b/examples/opcua/x509/main.cpp
@@ -16,10 +16,14 @@ int main(int argc, char **argv)
// Generate RSA Key
QOpcUaKeyPair key;
- key.generateRsaKey(QOpcUaKeyPair::RsaKeyStrength::Bits1024);
+ key.generateRsaKey(QOpcUaKeyPair::RsaKeyStrength::Bits2048);
// Save private key to file
- QByteArray keyData = key.privateKeyToByteArray(QOpcUaKeyPair::Cipher::Aes128Cbc, "password");
+ QByteArray keyData = key.privateKeyToByteArray(QOpcUaKeyPair::Cipher::Unencrypted, QString());
+
+ // In order to create a private key file with password for the Unified Automation plugin,
+ // the following invocation can be used:
+ // QByteArray keyData = key.privateKeyToByteArray(QOpcUaKeyPair::Cipher::Aes128Cbc, "password");
QFile keyFile("privateKey.pem");
keyFile.open(QFile::WriteOnly);