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
7924fd45
Commit
7924fd45
authored
Dec 17, 2019
by
mar-ar
Committed by
oroulet
Dec 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enabled to use pem format without ending .pem
parent
a9397ca8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
asyncua/crypto/uacrypto.py
asyncua/crypto/uacrypto.py
+4
-4
asyncua/server/server.py
asyncua/server/server.py
+4
-4
No files found.
asyncua/crypto/uacrypto.py
View file @
7924fd45
...
...
@@ -12,10 +12,10 @@ from cryptography.hazmat.primitives.ciphers import algorithms
from
cryptography.hazmat.primitives.ciphers
import
modes
async
def
load_certificate
(
path
):
async
def
load_certificate
(
path
,
format
=
None
):
_
,
ext
=
os
.
path
.
splitext
(
path
)
async
with
aiofiles
.
open
(
path
,
mode
=
'rb'
)
as
f
:
if
ext
==
".pem"
:
if
ext
==
".pem"
or
format
==
'pem'
or
format
==
'PEM'
:
return
x509
.
load_pem_x509_certificate
(
await
f
.
read
(),
default_backend
())
else
:
return
x509
.
load_der_x509_certificate
(
await
f
.
read
(),
default_backend
())
...
...
@@ -27,10 +27,10 @@ def x509_from_der(data):
return
x509
.
load_der_x509_certificate
(
data
,
default_backend
())
async
def
load_private_key
(
path
):
async
def
load_private_key
(
path
,
format
=
None
):
_
,
ext
=
os
.
path
.
splitext
(
path
)
async
with
aiofiles
.
open
(
path
,
mode
=
'rb'
)
as
f
:
if
ext
==
".pem"
:
if
ext
==
".pem"
or
format
==
'pem'
or
format
==
'PEM'
:
return
serialization
.
load_pem_private_key
(
await
f
.
read
(),
password
=
None
,
backend
=
default_backend
())
else
:
return
serialization
.
load_der_private_key
(
await
f
.
read
(),
password
=
None
,
backend
=
default_backend
())
...
...
asyncua/server/server.py
View file @
7924fd45
...
...
@@ -125,14 +125,14 @@ class Server:
return
f"OPC UA Server(
{
self
.
endpoint
.
geturl
()
}
)"
__repr__
=
__str__
async
def
load_certificate
(
self
,
path
:
str
):
async
def
load_certificate
(
self
,
path
:
str
,
format
:
str
=
None
):
"""
load server certificate from file, either pem or der
"""
self
.
certificate
=
await
uacrypto
.
load_certificate
(
path
)
self
.
certificate
=
await
uacrypto
.
load_certificate
(
path
,
format
)
async
def
load_private_key
(
self
,
path
):
self
.
iserver
.
private_key
=
await
uacrypto
.
load_private_key
(
path
)
async
def
load_private_key
(
self
,
path
,
format
=
None
):
self
.
iserver
.
private_key
=
await
uacrypto
.
load_private_key
(
path
,
format
)
def
disable_clock
(
self
,
val
:
bool
=
True
):
"""
...
...
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