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
caa898c4
Commit
caa898c4
authored
Mar 26, 2023
by
Alexander Schrode
Committed by
oroulet
Mar 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle server cert in create session
parent
fd7d3c0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
asyncua/client/client.py
asyncua/client/client.py
+9
-2
No files found.
asyncua/client/client.py
View file @
caa898c4
...
@@ -468,9 +468,16 @@ class Client:
...
@@ -468,9 +468,16 @@ class Client:
data
=
self
.
security_policy
.
host_certificate
+
nonce
data
=
self
.
security_policy
.
host_certificate
+
nonce
self
.
security_policy
.
asymmetric_cryptography
.
verify
(
data
,
response
.
ServerSignature
.
Signature
)
self
.
security_policy
.
asymmetric_cryptography
.
verify
(
data
,
response
.
ServerSignature
.
Signature
)
self
.
_server_nonce
=
response
.
ServerNonce
self
.
_server_nonce
=
response
.
ServerNonce
# If a server has certificate chain, the certificates are chained
# this generates a error in our crypto part, so we strip everything after
# the server cert. To do this we read byte 2:4 and get the length - 4
cert_len_idx
=
2
len_bytestr
=
response
.
ServerCertificate
[
cert_len_idx
:
cert_len_idx
+
2
]
cert_len
=
int
.
from_bytes
(
len_bytestr
,
byteorder
=
"big"
,
signed
=
False
)
+
4
server_certificate
=
response
.
ServerCertificate
[:
cert_len
]
if
not
self
.
security_policy
.
peer_certificate
:
if
not
self
.
security_policy
.
peer_certificate
:
self
.
security_policy
.
peer_certificate
=
response
.
ServerC
ertificate
self
.
security_policy
.
peer_certificate
=
server_c
ertificate
elif
self
.
security_policy
.
peer_certificate
!=
response
.
ServerC
ertificate
:
elif
self
.
security_policy
.
peer_certificate
!=
server_c
ertificate
:
raise
ua
.
UaError
(
"Server certificate mismatch"
)
raise
ua
.
UaError
(
"Server certificate mismatch"
)
# remember PolicyId's: we will use them in activate_session()
# remember PolicyId's: we will use them in activate_session()
ep
=
Client
.
find_endpoint
(
response
.
ServerEndpoints
,
self
.
security_policy
.
Mode
,
self
.
security_policy
.
URI
)
ep
=
Client
.
find_endpoint
(
response
.
ServerEndpoints
,
self
.
security_policy
.
Mode
,
self
.
security_policy
.
URI
)
...
...
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