Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Trust and Identity Incubator
alternate-mdx
Commits
375a67cc
Commit
375a67cc
authored
Jan 26, 2022
by
Martin van Es
Browse files
Use xmlsec for all signing
parent
0f33dbb2
Changes
4
Hide whitespace changes
Inline
Side-by-side
mdserver.py
View file @
375a67cc
#!/usr/bin/env python
from
utils
import
read_config
,
Resource
,
s
erver
from
utils
import
read_config
,
Resource
,
S
erver
from
flask
import
Flask
,
Response
config
=
read_config
()
app
=
Flask
(
__name__
)
server
=
Server
()
@
app
.
route
(
'/<domain>/entities/<path:entity_id>'
,
methods
=
[
'GET'
])
def
serve
(
domain
,
entity_id
):
...
...
mdsigner.py
View file @
375a67cc
...
...
@@ -6,8 +6,8 @@ from concurrent.futures import ThreadPoolExecutor
from
lxml
import
etree
as
ET
# import traceback
from
utils
import
hasher
,
Signers
from
utils
import
hasher
from
signers
import
Signers
# Find all IdP's in edugain metadata
idps
=
[]
...
...
signers.py
View file @
375a67cc
import
xmlsec
from
signxml
import
XMLSigner
cert
=
open
(
"meta.crt"
).
read
()
key
=
open
(
"meta.key"
).
read
()
cert
=
"meta.crt"
key
=
"meta.key"
def
Signers
(
signer
):
def
_normal_signer
(
xml
):
print
(
"Normal signer"
)
return
XMLSigner
()
.
sign
(
xml
,
key
=
key
,
cert
=
cert
)
return
xmlsec
.
sign
(
xml
,
key
_spec
=
key
,
cert
_spec
=
cert
)
def
_test_signer
(
xml
):
print
(
"Test signer"
)
return
XMLSigner
()
.
sign
(
xml
,
key
=
key
,
cert
=
cert
)
return
xmlsec
.
sign
(
xml
,
key
_spec
=
key
,
cert
_spec
=
cert
)
def
_foobar_signer
(
xml
):
print
(
"Foobar signer"
)
return
XMLSigner
()
.
sign
(
xml
,
key
=
key
,
cert
=
cert
)
return
xmlsec
.
sign
(
xml
,
key
_spec
=
key
,
cert
_spec
=
cert
)
def
_hsm_signer
(
xml
):
print
(
"HSM signer"
)
...
...
utils.py
View file @
375a67cc
...
...
@@ -151,6 +151,3 @@ class Server:
def
__getitem__
(
self
,
domain
):
return
self
.
__dict__
[
domain
]
server
=
Server
()
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