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
fd0feb49
Commit
fd0feb49
authored
Jan 03, 2016
by
ORD
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #98 from alkor/fixes
Fixes
parents
4f41b4eb
62b3674e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
12 deletions
+17
-12
opcua/internal_server.py
opcua/internal_server.py
+1
-1
opcua/security_policies.py
opcua/security_policies.py
+3
-2
opcua/tools.py
opcua/tools.py
+5
-2
opcua/uacrypto.py
opcua/uacrypto.py
+7
-6
opcua/uaprotocol_hand.py
opcua/uaprotocol_hand.py
+1
-1
No files found.
opcua/internal_server.py
View file @
fd0feb49
...
...
@@ -115,7 +115,7 @@ class InternalServer(object):
url
=
url
.
_replace
(
netloc
=
sockname
[
0
]
+
":"
+
str
(
sockname
[
1
]))
edp1
.
EndpointUrl
=
url
.
geturl
()
edps
.
append
(
edp1
)
return
edps
return
edps
return
self
.
endpoints
[:]
def
find_servers
(
self
,
params
):
...
...
opcua/security_policies.py
View file @
fd0feb49
...
...
@@ -249,7 +249,7 @@ class SignerAesCbc(Signer):
return
uacrypto
.
sha1_size
()
def
signature
(
self
,
data
):
return
uacrypto
.
h
ash_hmac
(
self
.
key
,
data
)
return
uacrypto
.
h
mac_sha1
(
self
.
key
,
data
)
class
VerifierAesCbc
(
Verifier
):
...
...
@@ -261,7 +261,7 @@ class VerifierAesCbc(Verifier):
return
uacrypto
.
sha1_size
()
def
verify
(
self
,
data
,
signature
):
expected
=
uacrypto
.
h
ash_hmac
(
self
.
key
,
data
)
expected
=
uacrypto
.
h
mac_sha1
(
self
.
key
,
data
)
if
signature
!=
expected
:
raise
uacrypto
.
InvalidSignature
...
...
@@ -403,6 +403,7 @@ class SecurityPolicyBasic256(SecurityPolicy):
self
.
client_certificate
=
uacrypto
.
der_from_x509
(
client_cert
)
def
make_symmetric_key
(
self
,
nonce1
,
nonce2
):
# specs part 6, 6.7.5
key_sizes
=
(
self
.
signature_key_size
,
self
.
symmetric_key_size
,
16
)
(
sigkey
,
key
,
init_vec
)
=
uacrypto
.
p_sha1
(
nonce2
,
nonce1
,
key_sizes
)
...
...
opcua/tools.py
View file @
fd0feb49
...
...
@@ -475,7 +475,7 @@ def uaserver():
help
=
"Populate address space with nodes defined in XML"
)
parser
.
add_argument
(
"-p"
,
"--populate"
,
action
=
"store_
fals
e"
,
action
=
"store_
tru
e"
,
help
=
"Populate address space with some sample nodes"
)
parser
.
add_argument
(
"-c"
,
"--disable-clock"
,
...
...
@@ -515,13 +515,16 @@ def uaserver():
try
:
if
args
.
shell
:
embed
()
el
s
e
:
el
if
args
.
populat
e
:
count
=
0
while
True
:
time
.
sleep
(
1
)
myvar
.
set_value
(
math
.
sin
(
count
/
10
))
myarrayvar
.
set_value
([
math
.
sin
(
count
/
10
),
math
.
sin
(
count
/
100
)])
count
+=
1
else
:
while
True
:
time
.
sleep
(
1
)
finally
:
server
.
stop
()
sys
.
exit
(
0
)
...
...
opcua/uacrypto.py
View file @
fd0feb49
...
...
@@ -129,7 +129,7 @@ def cipher_decrypt(cipher, data):
return
decryptor
.
update
(
data
)
+
decryptor
.
finalize
()
def
h
ash_hmac
(
key
,
message
):
def
h
mac_sha1
(
key
,
message
):
hasher
=
hmac
.
HMAC
(
key
,
hashes
.
SHA1
(),
backend
=
default_backend
())
hasher
.
update
(
message
)
return
hasher
.
finalize
()
...
...
@@ -139,9 +139,10 @@ def sha1_size():
return
hashes
.
SHA1
.
digest_size
def
p_sha1
(
key
,
body
,
sizes
=
()):
def
p_sha1
(
secret
,
seed
,
sizes
=
()):
"""
Derive one or more keys from key and body.
Derive one or more keys from secret and seed.
(See specs part 6, 6.7.5 and RFC 2246 - TLS v1.0)
Lengths of keys will match sizes argument
"""
full_size
=
0
...
...
@@ -149,10 +150,10 @@ def p_sha1(key, body, sizes=()):
full_size
+=
size
result
=
b''
accum
=
body
accum
=
seed
while
len
(
result
)
<
full_size
:
accum
=
h
ash_hmac
(
key
,
accum
)
result
+=
h
ash_hmac
(
key
,
accum
+
body
)
accum
=
h
mac_sha1
(
secret
,
accum
)
result
+=
h
mac_sha1
(
secret
,
accum
+
seed
)
parts
=
[]
for
size
in
sizes
:
...
...
opcua/uaprotocol_hand.py
View file @
fd0feb49
...
...
@@ -212,7 +212,7 @@ class AsymmetricAlgorithmHeader(uatypes.FrozenClass):
return
hdr
def
__str__
(
self
):
return
"{}(Secur
y
tyPolicy:{}, certificatesize:{}, receiverCertificatesize:{} )"
.
format
(
self
.
__class__
.
__name__
,
self
.
SecurityPolicyURI
,
len
(
self
.
SenderCertificate
),
len
(
self
.
ReceiverCertificateThumbPrint
))
return
"{}(Secur
i
tyPolicy:{}, certificatesize:{}, receiverCertificatesize:{} )"
.
format
(
self
.
__class__
.
__name__
,
self
.
SecurityPolicyURI
,
len
(
self
.
SenderCertificate
),
len
(
self
.
ReceiverCertificateThumbPrint
))
__repr__
=
__str__
...
...
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