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
028a36d7
Commit
028a36d7
authored
Jan 01, 2016
by
ORD
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #96 from alkor/client-side-passwords
Support client-side encrypted passwords
parents
deca8fa6
fe544339
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
opcua/client.py
opcua/client.py
+5
-1
opcua/uacrypto.py
opcua/uacrypto.py
+1
-1
No files found.
opcua/client.py
View file @
028a36d7
...
...
@@ -357,7 +357,11 @@ class Client(object):
params
.
UserIdentityToken
.
UserName
=
username
if
self
.
server_url
.
password
:
pubkey
=
uacrypto
.
x509_from_der
(
self
.
security_policy
.
server_certificate
).
public_key
()
data
=
uacrypto
.
encrypt_basic256
(
pubkey
,
bytes
(
password
,
"utf8"
))
# see specs part 4, 7.36.3: if the token is encrypted, password
# shall be converted to UTF-8 and serialized with server nonce
etoken
=
ua
.
pack_bytes
(
bytes
(
password
,
"utf8"
)
+
self
.
_server_nonce
)
#data = uacrypto.encrypt_basic256(pubkey, etoken)
data
=
uacrypto
.
encrypt_rsa_oaep
(
pubkey
,
etoken
)
params
.
UserIdentityToken
.
Password
=
data
params
.
UserIdentityToken
.
PolicyId
=
self
.
server_policy_id
(
ua
.
UserTokenType
.
UserName
,
b"username_basic256"
)
params
.
UserIdentityToken
.
EncryptionAlgorithm
=
'http://www.w3.org/2001/04/xmlenc#rsa-oaep'
...
...
opcua/uacrypto.py
View file @
028a36d7
...
...
@@ -28,7 +28,7 @@ def x509_from_der(data):
def
x509_to_der
(
cert
):
if
not
data
:
if
not
cert
:
return
b''
return
cert
.
public_bytes
(
serialization
.
Encoding
.
DER
)
...
...
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