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
6581f2c5
Commit
6581f2c5
authored
Nov 20, 2017
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix suspect line in encoding and fix (small) errors it was hiding
parent
02b764c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
opcua/client/client.py
opcua/client/client.py
+2
-2
opcua/server/event_generator.py
opcua/server/event_generator.py
+1
-1
opcua/ua/ua_binary.py
opcua/ua/ua_binary.py
+17
-9
No files found.
opcua/client/client.py
View file @
6581f2c5
...
...
@@ -412,7 +412,7 @@ class Client(object):
challenge
+=
self
.
security_policy
.
server_certificate
if
self
.
_server_nonce
is
not
None
:
challenge
+=
self
.
_server_nonce
params
.
ClientSignature
.
Algorithm
=
b
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
params
.
ClientSignature
.
Algorithm
=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
params
.
ClientSignature
.
Signature
=
self
.
security_policy
.
asymmetric_cryptography
.
signature
(
challenge
)
params
.
LocaleIds
.
append
(
"en"
)
if
not
username
and
not
certificate
:
...
...
@@ -435,7 +435,7 @@ class Client(object):
# the last serverNonce to the serverCertificate
sig
=
uacrypto
.
sign_sha1
(
self
.
user_private_key
,
challenge
)
params
.
UserTokenSignature
=
ua
.
SignatureData
()
params
.
UserTokenSignature
.
Algorithm
=
b
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
params
.
UserTokenSignature
.
Algorithm
=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
params
.
UserTokenSignature
.
Signature
=
sig
def
_add_user_auth
(
self
,
params
,
username
,
password
):
...
...
opcua/server/event_generator.py
View file @
6581f2c5
...
...
@@ -85,7 +85,7 @@ class EventGenerator(object):
"""
Trigger the event. This will send a notification to all subscribed clients
"""
self
.
event
.
EventId
=
ua
.
Variant
(
uuid
.
uuid4
().
hex
,
ua
.
VariantType
.
ByteString
)
self
.
event
.
EventId
=
ua
.
Variant
(
uuid
.
uuid4
().
hex
.
encode
(
'utf-8'
)
,
ua
.
VariantType
.
ByteString
)
if
time
:
self
.
event
.
Time
=
time
else
:
...
...
opcua/ua/ua_binary.py
View file @
6581f2c5
...
...
@@ -48,17 +48,20 @@ class _DateTime(object):
class
_String
(
object
):
@
staticmethod
def
pack
(
string
):
if
string
is
None
:
return
Primitives
.
Int32
.
pack
(
-
1
)
if
isinstance
(
string
,
unicode
):
string
=
string
.
encode
(
'utf-8'
)
length
=
len
(
string
)
return
Primitives
.
Int32
.
pack
(
length
)
+
string
if
string
is
not
None
:
if
sys
.
version_info
.
major
>
2
:
string
=
string
.
encode
(
'utf-8'
)
else
:
# we do not want this test to happen with python3
if
isinstance
(
string
,
unicode
):
string
=
string
.
encode
(
'utf-8'
)
return
_Bytes
.
pack
(
string
)
@
staticmethod
def
unpack
(
data
):
b
=
_Bytes
.
unpack
(
data
)
if
sys
.
version_info
.
major
<
3
:
# return unicode(b)
return
b
else
:
if
b
is
None
:
...
...
@@ -69,7 +72,12 @@ class _String(object):
class
_Bytes
(
object
):
@
staticmethod
def
pack
(
data
):
return
_String
.
pack
(
data
)
if
data
is
None
:
return
Primitives
.
Int32
.
pack
(
-
1
)
length
=
len
(
data
)
if
not
isinstance
(
data
,
bytes
):
print
(
"BYTES EXPECTED"
,
type
(
Primitives
.
Int32
.
pack
(
length
)),
type
(
data
),
data
)
return
Primitives
.
Int32
.
pack
(
length
)
+
data
@
staticmethod
def
unpack
(
data
):
...
...
@@ -142,7 +150,7 @@ class _Primitive1(object):
return
None
if
length
==
0
:
return
()
return
struct
.
unpack
(
self
.
_fmt
.
format
(
length
),
data
.
read
(
self
.
size
*
length
))
return
struct
.
unpack
(
self
.
_fmt
.
format
(
length
),
data
.
read
(
self
.
size
*
length
))
class
Primitives1
(
object
):
...
...
@@ -258,7 +266,7 @@ def to_binary(uatype, val):
Pack a python object to binary given a string defining its type
"""
if
uatype
.
startswith
(
"ListOf"
):
#if isinstance(val, (list, tuple)):
#if isinstance(val, (list, tuple)):
return
list_to_binary
(
uatype
[
6
:],
val
)
elif
isinstance
(
uatype
,
(
str
,
unicode
))
and
hasattr
(
ua
.
VariantType
,
uatype
):
vtype
=
getattr
(
ua
.
VariantType
,
uatype
)
...
...
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