Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
2a3fccca
Commit
2a3fccca
authored
Jan 05, 2016
by
Alexander Korolkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add minimal example of server with encryption
Also add example certificate and private key
parent
afe4fb73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
0 deletions
+70
-0
examples/example-certificate.der
examples/example-certificate.der
+0
-0
examples/example-private-key.pem
examples/example-private-key.pem
+28
-0
examples/minimal-server-with-encryption.py
examples/minimal-server-with-encryption.py
+42
-0
No files found.
examples/example-certificate.der
0 → 100644
View file @
2a3fccca
File added
examples/example-private-key.pem
0 → 100644
View file @
2a3fccca
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCfaDB7pK/fmP/I
7IusSK8lTCBnPZghqIbVLt2QHYAMoEF1CaF4F4rxo2vl1Mt8gwsq4T3osQFZMvnL
YHb7KNyUoJgTjLxJQADv2u4Q3U38heAzK5Tp4ry4MCnuyJIqAPK1GiruwEq4zQrx
+WzVix8otO37SuW9tzklqlNGMiAYBL0TBKHvS5XMbjP1idBMB8erMz29w/TVQnEB
Kj0vCdZjrbVPKygptt5kcSrL5f4xCZwU+ufz7cp0GLwpRMJ+shG9YJJFBxb0itPF
sy51vAyEtdBC7jgAU96ZV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njF0H8oKmAY6hw+1Tm/n/b08p+RyL48TgVSE2vhUCgYA3BWpkD4PlCcn/FZsq
OrLFyFXI6jIaxskFtsRW1IxxIlAdZmxfB26P/2gx6VjLdxJI/RRPkJyEN2dP7CbR
BDjb565dy1O9D6+UrY70Iuwjz+OcALRBBGTaiF2pLn6IhSzNI2sy/tXX8q8dBlg9
OFCrqT/emes3KytTPfa5NZtYeQ==
-----END PRIVATE KEY-----
examples/minimal-server-with-encryption.py
0 → 100644
View file @
2a3fccca
import
sys
sys
.
path
.
insert
(
0
,
".."
)
import
time
from
opcua
import
ua
,
Server
if
__name__
==
"__main__"
:
# setup our server
server
=
Server
()
server
.
set_endpoint
(
"opc.tcp://0.0.0.0:4841/freeopcua/server/"
)
# load server certificate and private key. This enables endpoints
# with signing and encryption.
server
.
load_certificate
(
"example-certificate.der"
)
server
.
load_private_key
(
"example-private-key.pem"
)
# setup our own namespace, not really necessary but should as spec
uri
=
"http://examples.freeopcua.github.io"
idx
=
server
.
register_namespace
(
uri
)
# get Objects node, this is where we should put our custom stuff
objects
=
server
.
get_objects_node
()
# populating our address space
myobj
=
objects
.
add_object
(
idx
,
"MyObject"
)
myvar
=
myobj
.
add_variable
(
idx
,
"MyVariable"
,
6.7
)
myvar
.
set_writable
()
# Set MyVariable to be writable by clients
# starting!
server
.
start
()
try
:
count
=
0
while
True
:
time
.
sleep
(
1
)
count
+=
0.1
myvar
.
set_value
(
count
)
finally
:
#close connection, remove subcsriptions, etc
server
.
stop
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment