summaryrefslogtreecommitdiffstats
path: root/examples/remoteobjects/ssl/sslserver
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2018-07-02 15:41:24 +0200
committerBogDan Vatra <bogdan@kdab.com>2018-10-29 06:20:35 +0000
commit88673b336fd52c026134d1e348d12c310c48b1ac (patch)
treec0c59a79773d0a6b4eb3baeb9dfaefe2fcbc0d8f /examples/remoteobjects/ssl/sslserver
parente8f49d3bf0557cc3c1b1e0358bed720023fdc2b4 (diff)
Add SSL example & auto test
Change-Id: I3342507fa2ea69f753f1f062c233211fad4791ff Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Diffstat (limited to 'examples/remoteobjects/ssl/sslserver')
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/cert.qrc11
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/client.crt18
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/client.key27
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/rootCA.key27
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/rootCA.pem20
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/rootCA.srl1
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/server.crt18
-rw-r--r--examples/remoteobjects/ssl/sslserver/cert/server.key27
-rw-r--r--examples/remoteobjects/ssl/sslserver/main.cpp141
-rw-r--r--examples/remoteobjects/ssl/sslserver/sslserver.cpp79
-rw-r--r--examples/remoteobjects/ssl/sslserver/sslserver.h71
-rw-r--r--examples/remoteobjects/ssl/sslserver/sslserver.pro18
-rw-r--r--examples/remoteobjects/ssl/sslserver/timemodel.cpp90
-rw-r--r--examples/remoteobjects/ssl/sslserver/timemodel.h71
14 files changed, 619 insertions, 0 deletions
diff --git a/examples/remoteobjects/ssl/sslserver/cert/cert.qrc b/examples/remoteobjects/ssl/sslserver/cert/cert.qrc
new file mode 100644
index 0000000..65f92e2
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/cert.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/sslcert">
+ <file>client.crt</file>
+ <file>client.key</file>
+ <file>rootCA.key</file>
+ <file>rootCA.pem</file>
+ <file>rootCA.srl</file>
+ <file>server.crt</file>
+ <file>server.key</file>
+ </qresource>
+</RCC>
diff --git a/examples/remoteobjects/ssl/sslserver/cert/client.crt b/examples/remoteobjects/ssl/sslserver/cert/client.crt
new file mode 100644
index 0000000..e8c8c14
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/client.crt
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC8jCCAdoCCQDPkkFD8ish3zANBgkqhkiG9w0BAQsFADAxMQswCQYDVQQGEwJV
+UzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDAeFw0xODA3MDMw
+OTMyNTFaFw0yMzA3MDIwOTMyNTFaMEUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZP
+cmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRIwEAYDVQQDDAkxMjcuMC4wLjEwggEi
+MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDexH8hCVisI6sHb7o2nK3kMuwT
+DEBoQesEqZsfypiwOYkB2OqzW3HmFfDeUVKBGBJk07QPYM1v9ocaEbYFkAOpj1hH
+Gl02DihWqMqbFdwugV/z6dwo8r7ZOsCYhDeAhtXKbAX2ASGdlHusY9lIHRqGrlm3
+veHJrdXUAQAYHyI7XrinLV8RNCMDI3CVhcNEOc3C3AyufcXUZ1cEGAYDPXGtwPEd
+RFQQBbyYSQ4RgR2BlPkPE1VQiE01cDFMF8RNaQL89uhJkMruano+7eTawax1h8q4
+D2LK9sRPRtz7Zivx3Z2Vk9I7suX9C2RhuSgzHiXWuP7VBVcJiAL/GICoq9bJAgMB
+AAEwDQYJKoZIhvcNAQELBQADggEBABy/ofQyVtXNZ6thyU+M41m3nb2DFayFimjm
+wPcbgXR/EPyZrP2I1O8FZh7KlICg97kqPsN4CvVU6n9KVmM3EVzwNcPuwr0ufXHF
+nq/lrVvy0osNh8KzN8jpHZ8Dsl4XXnXAKh4oxCRVB+R4FVirBTAQiu7OUFk+s7I5
+hoXI47whP7sOmxB+2YbVFPSTj26pupssMHCDoxAXC36ARH/68itdX2LQ5iLoqzEI
+PNxuLY3fFEGnu0ymZUMuevIbD4tAZiIlw17gr683pwNCuEvKAyNoehLnknXIILs5
+pVx3XcS6vw5+IbQb+HdxT/RPm6U4fIZVFdoC2o/x1G8wzPJvW/0=
+-----END CERTIFICATE-----
diff --git a/examples/remoteobjects/ssl/sslserver/cert/client.key b/examples/remoteobjects/ssl/sslserver/cert/client.key
new file mode 100644
index 0000000..75e1f43
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/client.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpQIBAAKCAQEA3sR/IQlYrCOrB2+6Npyt5DLsEwxAaEHrBKmbH8qYsDmJAdjq
+s1tx5hXw3lFSgRgSZNO0D2DNb/aHGhG2BZADqY9YRxpdNg4oVqjKmxXcLoFf8+nc
+KPK+2TrAmIQ3gIbVymwF9gEhnZR7rGPZSB0ahq5Zt73hya3V1AEAGB8iO164py1f
+ETQjAyNwlYXDRDnNwtwMrn3F1GdXBBgGAz1xrcDxHURUEAW8mEkOEYEdgZT5DxNV
+UIhNNXAxTBfETWkC/PboSZDK7mp6Pu3k2sGsdYfKuA9iyvbET0bc+2Yr8d2dlZPS
+O7Ll/QtkYbkoMx4l1rj+1QVXCYgC/xiAqKvWyQIDAQABAoIBAQCDTQYxjrS5IXzZ
+MT1smwTTkEAdKgd8a/3+DYnlPyCoHgFnGVecx7VmjGAgaYZbmLievTlQJxpvd7tB
+3laPCMdf1aGOpzdxeP7FtU9WAZh5wL+xoJGngQyENWD3hFbCZrb0TJ9m1Fvf6XjL
+rz6Ohrjv0SwIZN8EZHW4M66+iPtASgabi2mgMl6tiF2p+Cl7CDSvd70u4WNEdhN5
+9rtLqReSYQmRHJvXddh6A1uSYujnYdV5tmg6tx1BkbFf9W6R5HllkOXLsT2c9uGD
+qO/8hZxzf8bJICJe/2aoKC6WEXdMkkasMgtEMlPXIPITxspZvjDeGwy2/A6CnloX
+sCoHlaABAoGBAPaj/LZxyyRT2rELATtZbLs/G8hXQKnywihSSnaeLpf2p/VyBpOx
+cJtTMvKcPACEfnX3n40cMVbC3XOx/prbYxs5PFhzTkhPk5v5joGymRtmNajpm2/a
+G2tbYBC/lCHLDj6Jw0i1VFIB620WtnTm9agf7zRCholSBbeRl21CyMUBAoGBAOc4
+l8WgXU/Nv+mmGgv94GZCdLYTHo5WEKbBN3uaXZaLU6YA00Hkroa4xh5Ic+7tRTBw
+T+byoKicn7XuCNeJRy0FDxPgLj+d70sZ6Fzxq9xP8uwQ8gD/G2jO5v3e4O3F70sf
+DjpTrFRZXC/isNooE1HCerjS9fPs619m98ylfCnJAoGAWgMzQap6BwILeD2Z730N
+b7DyhMVDNkMAlRKjVnMYciF03uEEgXZqsGVG3MAkLdQtCwSaWDeH0jA//e9iCkYy
+/0Z+PZGnakCQkIYdejwiIJvGzaSkM8gX5bBteO9SMpsW0cAZYzm6UkudDi0R3cxE
+r10oQZxd2VPz/jDGYPvUpgECgYEAvT1+SksT0+rrdUly6/mfHVKqvxIq4gfinPhq
+dolCq6Hglm76eGW3yZ+U1tgpupULGbfyTWyqvRVjSb1GE1HRpTEMxBGpCHw0i1zq
+5pcNN8VfZoH/73zbbA5a09EEetaTIQKL3IT6+BYi8zYv1H0UQshPNNHEZx2zDmPx
+z9ZpJrECgYEAmxsv/6LNyV5+h8WOdyHtNFF04jo1s9CfRc0fMkKVQNZVaOu3sgLZ
+B4r2XrK75S19iJj4AVxf7dP3EbblDXvnQhlLV8IcYuULDovdXvYJrkv2a0KQ5nqO
+mt8brk85kb/GW8MrYHwLeFYSytZk267osPlwzIW1Zr9pDpARSVXer98=
+-----END RSA PRIVATE KEY-----
diff --git a/examples/remoteobjects/ssl/sslserver/cert/rootCA.key b/examples/remoteobjects/ssl/sslserver/cert/rootCA.key
new file mode 100644
index 0000000..4603898
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/rootCA.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAnFgYQwg4xeA2yYnWZ0TqZCEBlzg2zbi0ToeO3msOYI7m6urI
+/gUp3uezK/5bO9xVudRYq9qbK/1XmAhD+oILxVFY8VHO9p7xGVav2T8cPtFUkj05
+9WT7TDlOwEIOyb7WbEjLE1a0u9Iyl6Ju7VwCf0xijtD8TomB41PojNe49G1JN5CK
+AdkCYyrgjCBj13iZo9VFp/xWWTfk6iPa928AavYYUWHizAc3Kvr46DGW9pIjPthH
+EC6dmiX0oHfLF8HcTvgL/pHzF2bT5grYoARwIectD996z8smrsN7clfjMHwDHH8a
+OCgIvNNOs4jWSu6oXqEwvGyRxmsHFi1jbhHNkwIDAQABAoIBADmSQxTkASv0fZhH
+VpleikVm1hQeUif9HQBR8K08lOW/mY7l+C96LUn03kiT+HqZj0PHywM1k7BmMQw9
+9vJXUwhNBUiPzHuKWdPv1P9Vuwvyv4a+XwpbLiKKc9JeQN3PlVv4jjdH1XPYWmL2
+IIztNco0kZJvqIkvH5JbgqXihiwTQuyw6SnvF/kxZmTFnX9uzakNW/fYhE1rHig8
+Z/l4Ojhh9rvE//aCS0FMGd5GFNzoWyOSSExvZePupWgYsQluBQFgZK9Mh2EmObnY
+o8yy7DZ93JKSwFxVouj4Oqm9jX3Xq/v2Oz9ZN8ZoOeS4IvgWHoPCNDbFllrTWLDi
+r8aG5EECgYEAyD+Gq74db6C6Of4C8L29SLdPglsLlkR2ZVZN3d8DcysEiGlLHbRB
+STNYvFw3T4zmkOJQhcCmfrUAZ1D7ybvCxifyLR0xkjz50ALwzNTyg0VgBPVJWfLx
+nNzuF47Vtmu33P0xCiMUg7PDhIV22zaaBhgNqaNZFCGhyGrLisQwdKECgYEAx99b
+ErYq9P7/GP27J3SIL2TY9dWWBQBMpXx+GaHE0gOixrL6ZYrS0hVik60K/trgDGUx
+RTu4K8JLSo7NQqDcuRXVfMguNNrrAZ3DxqMJ8D2vS9ObDRa0hl2ctKAoIfno8xII
+PVGcSShrJvpw/P9AdkEYUUYZHJPDfWbqOZB3obMCgYAspNUOZwVDBM9f7HyVVYfk
+tVGZm1i6+Kp4r0QO6hBn1bhd/TOM/MntWvA2lkyShLRGqt4O48N6zjm3zvtDn4Ou
+D+vTGQYbN1LuiClNUVB76bSdhl4DGsG5GhxOzj5hPCSytRQA0Y9aSXKWkfbMqqCu
+KSCqqEtMzK638u9MEa9H4QKBgFOQRntkPkF/+xdvvbeZOPbXqv3c9oPQxDrL+cyt
+naRQcNWyLo4VpF7BIh2r01UKHXIRPLA9b5qb+O6LFbYtmxqmzkMFTow6mtZqJ1f9
+AkK3B3skVUb7ny4uJT4/V4gc/A/kEh3Q6Q6NH3+EZYjhDwph3NDeBdG01Z6wUG0Q
+wXORAoGAQwdTtwI1mXtCF/AXYdgdpLxwP1mtevfxt7j65CPQYOQK4ceu54Ka48+8
+2TkmC/WjyWtM1YJZtArJsFBGYcX4WoVtGCU1Mbl19+1vKQMb1dlOC0HqU0c9UCcu
+fD6y4coCLXemKOJ32sHMdy8qyFxOz2CrznZa4uYBT4Lid8SY+yY=
+-----END RSA PRIVATE KEY-----
diff --git a/examples/remoteobjects/ssl/sslserver/cert/rootCA.pem b/examples/remoteobjects/ssl/sslserver/cert/rootCA.pem
new file mode 100644
index 0000000..6f3f886
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/rootCA.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDODCCAiCgAwIBAgIJAJDf3heNbfP6MA0GCSqGSIb3DQEBCwUAMDExCzAJBgNV
+BAYTAlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMB4XDTE4
+MDcwMzA5MzI1MFoXDTIzMDcwMjA5MzI1MFowMTELMAkGA1UEBhMCVVMxDzANBgNV
+BAgMBk9yZWdvbjERMA8GA1UEBwwIUG9ydGxhbmQwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQCcWBhDCDjF4DbJidZnROpkIQGXODbNuLROh47eaw5gjubq
+6sj+BSne57Mr/ls73FW51Fir2psr/VeYCEP6ggvFUVjxUc72nvEZVq/ZPxw+0VSS
+PTn1ZPtMOU7AQg7JvtZsSMsTVrS70jKXom7tXAJ/TGKO0PxOiYHjU+iM17j0bUk3
+kIoB2QJjKuCMIGPXeJmj1UWn/FZZN+TqI9r3bwBq9hhRYeLMBzcq+vjoMZb2kiM+
+2EcQLp2aJfSgd8sXwdxO+Av+kfMXZtPmCtigBHAh5y0P33rPyyauw3tyV+MwfAMc
+fxo4KAi8006ziNZK7qheoTC8bJHGawcWLWNuEc2TAgMBAAGjUzBRMB0GA1UdDgQW
+BBRFDBFImjfGGcuUO2yGvXFtkj+tATAfBgNVHSMEGDAWgBRFDBFImjfGGcuUO2yG
+vXFtkj+tATAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCbBnbX
+ms5mFTaPJislt+8A7c/HKz5S5U2jg4+5Nh7b7szbG3s/AGDuSwEQDRAU5J8gqb1r
+IkmrkZA3C8mEY/NLzDjbbW+T0z7zlXFXWKZmzhx+ROONys1HGKwNRe/oa9cAJnbv
+KeMfruIXeSTf6U9tehUdoEk87eTAONm4PtVgE4aenSxaIdT7dXlzYBzhCFzsXH/y
+VyNQD0wd7u+L6av+zRod7Sz7WU/Lnhi1fQXcFmmAmmmCHyctI0xgwdRB9O80ls8s
+Ea+0J9Mkt07YTKcG1ZpmJHU915M/aDDpV/2RGcYGLOHOrD1IT8Cl3ZwHGlERI3y6
++GFPhQzo4mXu3pdb
+-----END CERTIFICATE-----
diff --git a/examples/remoteobjects/ssl/sslserver/cert/rootCA.srl b/examples/remoteobjects/ssl/sslserver/cert/rootCA.srl
new file mode 100644
index 0000000..8888354
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/rootCA.srl
@@ -0,0 +1 @@
+CF924143F22B21E0
diff --git a/examples/remoteobjects/ssl/sslserver/cert/server.crt b/examples/remoteobjects/ssl/sslserver/cert/server.crt
new file mode 100644
index 0000000..0587867
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/server.crt
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC7zCCAdcCCQDPkkFD8ish4DANBgkqhkiG9w0BAQsFADAxMQswCQYDVQQGEwJV
+UzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDAeFw0xODA3MDMw
+OTMyNTFaFw0yMzA3MDIwOTMyNTFaMEIxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZP
+cmVnb24xDjAMBgNVBAcMBVNhbGVtMRIwEAYDVQQDDAkxMjcuMC4wLjEwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1zm/3QDUh1FhAczb7zDzme2Ncgs3x
+26RNMCS+DKQS8mf4tuyBT/62Ba8pMgOi46hS2/7BKbCFlU3F4rZiz/2y50fs5m0z
+Puf9sB6xGrya4hzLS7gML7QbP3gXvmWSYRGLT4kpK7Cf58nK9P8NWbgzcX95bjlV
+QDyUdLNy9wnH5xuumdIk7Il4EmSjWyL7N5PtEpfgvG79DAh8AiWvVWKgddVbkAUy
+s4kI+2LJ3NKfLGqh0ijY00a6KD7wuAAyws5EqQQ3/BYDf6/dSRXRMED/0gg1XPF5
+7VtTDltwneelfVI1SBhgHTE5ynN0WiTP5LaVPs6jQPJXNslvbWWbyngNAgMBAAEw
+DQYJKoZIhvcNAQELBQADggEBAEGGolgL7wv4NwuAfFA0fPu6VZOfqgqw3g5M2gpw
+7+XcUSWdum/8yUxkeaI5fLSA3sq6PefLaMpZ7+2JQYKJZZ4zl3fJ5D1M/VMQOQ1Q
+PAMzGjHNZ7T0vs5F5TdpbXpEbvcBvLz/k2FRMs2Z/WBQZQITEiQ1wf91jxc4dQr5
+nM6CN0TUW8wCKOi+8QXruUnHnaPreRh68A2FfnGSBJlkImhkFjAMtIdpkAHTiNs+
+PE/Dx58wsrnY6DiZfYPrKj54TkdnoKpWCLarxuMzeGUEvQcaXhksnRfDBc5k4ev4
+g7RhsGXyIJvFFvKVeH9GbGfgSXn7rc6Tesnzyh+mvHT3vMU=
+-----END CERTIFICATE-----
diff --git a/examples/remoteobjects/ssl/sslserver/cert/server.key b/examples/remoteobjects/ssl/sslserver/cert/server.key
new file mode 100644
index 0000000..e9bc3a1
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/cert/server.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAtc5v90A1IdRYQHM2+8w85ntjXILN8dukTTAkvgykEvJn+Lbs
+gU/+tgWvKTIDouOoUtv+wSmwhZVNxeK2Ys/9sudH7OZtMz7n/bAesRq8muIcy0u4
+DC+0Gz94F75lkmERi0+JKSuwn+fJyvT/DVm4M3F/eW45VUA8lHSzcvcJx+cbrpnS
+JOyJeBJko1si+zeT7RKX4Lxu/QwIfAIlr1VioHXVW5AFMrOJCPtiydzSnyxqodIo
+2NNGuig+8LgAMsLORKkEN/wWA3+v3UkV0TBA/9IINVzxee1bUw5bcJ3npX1SNUgY
+YB0xOcpzdFokz+S2lT7Oo0DyVzbJb21lm8p4DQIDAQABAoIBAFbJrk9Uekik6mAR
+3/yBecz4t+zwkElVdXBXfCKxPB3DU/i5sdrlCg1wVzaOJog6rx6m4EzrjtWl+VNu
+r2wqJ8ygdYhUU2q0K+DBk1UuEzzIlcBCbCB9ITgkqzqCbFBdQBfFpw9dSNp8tqrJ
+G3wPCUydcKHSCVJ18LVZpFRMM4IWNWeIr2P3GvlXHTZodYkVRgb/A0Wr8BS+tlVx
+lGSOETgihNgyzG8tB3TZDrhlc2So6zrU0E+Akk8jXNARqBGUPwjeIORkX6RB913G
+mXqKpXRjdD8xzK/0a665wHv/3yFEuMjK/raiX/UrA/i01J++A0/PMyD8XoNLVcFk
+WG3mE20CgYEA6HYwnCb1lulMOJA/2QDDNSp/yeTlCo/5Oem0D/kzCuyiYlYZPMJY
+x33MoozY/4tdmajuYDiB71hj2pZLE3FYdpU4pmaR8G8T6Yf3KesvXoe9+89VUsS3
+bv2a6kfD1RHX+4DxRDIBbIKg11RBV2cOKsf1i0pn+VqkuJQcnVi+KKcCgYEAyDcs
+tSf6vJSAWgiJfNi5+wq0bxLZi+DL+9y6hmu1HrUUgMVUcU7qaKFHvq4NHR95Ww0q
+nxAjHB/KqRPLrDlIfkhmOttQThzEQClUUSS9f8BEndW/6BPBFVyAQS+GsDv55lEy
+n7LM9GaNu+CGq6zZPOFBnNVBW2E4fwIRkkLpvCsCgYAq9URwZua1l7FlNosGABUS
+6yKoXatR8188K4sB9KxRFX/AqmaJiuS7IO1DEMI9HzUR410B3Q9t+qihSWrgUe7m
+IxdP8N6BTxWf72dmkLa1QmKCeUMsQ3wef7E0IET5SA3gxWhQkOkgc1dj04crrri4
+gTFIJ1zlgLG2BnDvRuoFOwKBgCueiaj2CtRm7gevcHS4qtwcmu7QBoFI+mfm0ORU
+NuN3w/3CAAGnlb4x1PWf6c98ee3yUmTRGTUZYAex/l+JI1gP4eXUvgwmjEMGPg5n
+mLlqZAiW9vZSx3Al9PM+rXNbvbgF3KeaRrjAVwSlh/GC+NkgojDO7SxBZBOXmchp
+t459AoGABXvsiqC8TxAyGTlnVUTNlWnWzo7Qy+DHsJUgLvEdW47oairtdvGjCWFU
+dBk7qmxDNpEZ/0LrUtcgLwN/45PXOrKn0ojA86Csoij5HbsUx0c/g8bMES0ilghx
+tbEtOBkXNIPgmaXdyXW203i3/oLSY1nedePIbJU22nJzQHmw0mk=
+-----END RSA PRIVATE KEY-----
diff --git a/examples/remoteobjects/ssl/sslserver/main.cpp b/examples/remoteobjects/ssl/sslserver/main.cpp
new file mode 100644
index 0000000..bb00141
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/main.cpp
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "timemodel.h"
+
+#include <QCoreApplication>
+#include <QSslConfiguration>
+
+#include "sslserver.h"
+
+#include <QRemoteObjectHost>
+/*
+* http://stackoverflow.com/questions/7404163/windows-handling-ctrlc-in-different-thread
+*/
+
+void SigIntHandler()
+{
+ qDebug()<<"Ctrl-C received. Quitting.";
+ qApp->quit();
+}
+
+#if defined(Q_OS_UNIX) || defined(Q_OS_LINUX) || defined(Q_OS_QNX)
+#include <signal.h>
+
+void unix_handler(int s)
+{
+ if (s==SIGINT)
+ SigIntHandler();
+}
+
+#elif defined(Q_OS_WIN32)
+#include <windows.h>
+
+BOOL WINAPI WinHandler(DWORD CEvent)
+{
+ switch (CEvent)
+ {
+ case CTRL_C_EVENT:
+ SigIntHandler();
+ break;
+ }
+ return TRUE;
+}
+#endif
+
+/*
+ To generate certificates you can use the following commands:
+
+openssl genrsa -out rootCA.key 2048
+openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1825 -out rootCA.pem -subj "/C=US/ST=Oregon/L=Portland"
+
+openssl genrsa -out client.key 2048
+openssl req -new -key client.key -out client.csr -subj "/C=US/ST=Oregon/L=Portland/CN=127.0.0.1"
+openssl x509 -req -in client.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out client.crt -days 1825 -sha256
+
+openssl genrsa -out server.key 2048
+openssl req -new -key server.key -out server.csr -subj "/C=US/ST=Oregon/L=Salem/CN=127.0.0.1"
+openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 1825 -sha256
+*/
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ auto config = QSslConfiguration::defaultConfiguration();
+ config.setCaCertificates(QSslCertificate::fromPath(QStringLiteral(":/sslcert/rootCA.pem")));
+ QSslConfiguration::setDefaultConfiguration(config);
+
+#if defined(Q_OS_UNIX) || defined(Q_OS_LINUX) || defined(Q_OS_QNX)
+ signal(SIGINT, &unix_handler);
+#elif defined(Q_OS_WIN32)
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)WinHandler, TRUE);
+#endif
+ QRemoteObjectHost host;
+ SslServer server;
+ server.listen(QHostAddress::Any, 65511);
+
+ host.setHostUrl(server.serverAddress().toString(), QRemoteObjectHost::AllowExternalRegistration);
+
+ QObject::connect(&server, &SslServer::encryptedSocketReady, &server, [&host](QSslSocket *socket) {
+ QObject::connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QSslSocket::error),
+ socket, [](QAbstractSocket::SocketError error){
+ qDebug() << "QSslSocket::error" << error;
+ }) ;
+ host.addHostSideConnection(socket);
+ });
+
+ MinuteTimer timer;
+ host.enableRemoting(&timer);
+
+ Q_UNUSED(timer);
+ return app.exec();
+}
+
diff --git a/examples/remoteobjects/ssl/sslserver/sslserver.cpp b/examples/remoteobjects/ssl/sslserver/sslserver.cpp
new file mode 100644
index 0000000..02eeaa6
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/sslserver.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "sslserver.h"
+#include <QSslSocket>
+
+SslServer::SslServer(QObject *parent)
+ : QTcpServer(parent)
+{}
+
+
+void SslServer::incomingConnection(qintptr socketDescriptor)
+{
+ auto serverSocket = new QSslSocket;
+ if (serverSocket->setSocketDescriptor(socketDescriptor)) {
+ addPendingConnection(serverSocket);
+ connect(serverSocket, &QSslSocket::encrypted, this, [this, serverSocket] {
+ Q_EMIT encryptedSocketReady(serverSocket);
+ });
+ connect(serverSocket, static_cast<void (QSslSocket::*)(const QList<QSslError>&)>(&QSslSocket::sslErrors),
+ this, [serverSocket](const QList<QSslError>& errors){
+ qWarning() << "Error:" << serverSocket << errors;
+ delete serverSocket;
+ });
+ serverSocket->setPeerVerifyMode(QSslSocket::VerifyPeer);
+ serverSocket->setLocalCertificate(QStringLiteral(":/sslcert/server.crt"));
+ serverSocket->setPrivateKey(QStringLiteral(":/sslcert/server.key"));
+ serverSocket->startServerEncryption();
+ } else {
+ delete serverSocket;
+ }
+}
diff --git a/examples/remoteobjects/ssl/sslserver/sslserver.h b/examples/remoteobjects/ssl/sslserver/sslserver.h
new file mode 100644
index 0000000..3dfd511
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/sslserver.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SSLSERVER_H
+#define SSLSERVER_H
+
+#include <QTcpServer>
+
+QT_BEGIN_NAMESPACE
+class QSslSocket;
+QT_END_NAMESPACE
+
+class SslServer : public QTcpServer
+{
+ Q_OBJECT
+public:
+ SslServer(QObject *parent=nullptr);
+ void incomingConnection(qintptr socketDescriptor) override;
+
+signals:
+ void encryptedSocketReady(QSslSocket *socket);
+};
+
+#endif // SSLSERVER_H
diff --git a/examples/remoteobjects/ssl/sslserver/sslserver.pro b/examples/remoteobjects/ssl/sslserver/sslserver.pro
new file mode 100644
index 0000000..ac3802f
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/sslserver.pro
@@ -0,0 +1,18 @@
+CONFIG += console
+
+
+REPC_SOURCE += ../../timemodel.rep
+QT = remoteobjects remoteobjects-private core
+
+SOURCES += timemodel.cpp main.cpp \
+ sslserver.cpp
+HEADERS += timemodel.h \
+ sslserver.h
+
+contains(QT_CONFIG, c++11): CONFIG += c++11
+
+target.path = $$[QT_INSTALL_EXAMPLES]/remoteobjects/ssl/sslserver
+INSTALLS += target
+
+RESOURCES += \
+ cert/cert.qrc
diff --git a/examples/remoteobjects/ssl/sslserver/timemodel.cpp b/examples/remoteobjects/ssl/sslserver/timemodel.cpp
new file mode 100644
index 0000000..a444f6e
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/timemodel.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "timemodel.h"
+
+MinuteTimer::MinuteTimer(QObject *parent) : MinuteTimerSimpleSource(parent), zone(0)
+{
+ time = QTime::currentTime();
+ setHour(time.hour());
+ setMinute(time.minute());
+ timer.start(60000-time.second()*1000, this);
+}
+MinuteTimer::~MinuteTimer()
+{
+ timer.stop();
+}
+void MinuteTimer::timerEvent(QTimerEvent *)
+{
+ QTime now = QTime::currentTime();
+ if (now.second() == 59 && now.minute() == time.minute() && now.hour() == time.hour()) {
+ // just missed time tick over, force it, wait extra 0.5 seconds
+ time = time.addSecs(60);
+ timer.start(60500, this);
+ } else {
+ time = now;
+ timer.start(60000-time.second()*1000, this);
+ }
+ qDebug()<<"Time"<<time;
+ setHour(time.hour());
+ setMinute(time.minute());
+ emit timeChanged();
+ emit timeChanged2(time);
+ static PresetInfo bla(3, 93.9f, "Best Station");
+ emit sendCustom(bla);
+}
+void MinuteTimer::SetTimeZone(const int &zn)
+{
+ qDebug()<<"SetTimeZone"<<zn;
+ if (zn != zone)
+ {
+ zone = zn;
+ }
+}
diff --git a/examples/remoteobjects/ssl/sslserver/timemodel.h b/examples/remoteobjects/ssl/sslserver/timemodel.h
new file mode 100644
index 0000000..09c594a
--- /dev/null
+++ b/examples/remoteobjects/ssl/sslserver/timemodel.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include "rep_timemodel_source.h"
+
+class MinuteTimer : public MinuteTimerSimpleSource
+{
+ Q_OBJECT
+public:
+ MinuteTimer(QObject *parent = nullptr);
+ ~MinuteTimer() override;
+
+public slots:
+ void SetTimeZone(const int &zn) override;
+
+protected:
+ void timerEvent(QTimerEvent *) override;
+
+private:
+ QTime time;
+ QBasicTimer timer;
+ int zone;
+};