Commit 375a67cc authored by Martin van Es's avatar Martin van Es
Browse files

Use xmlsec for all signing

parent 0f33dbb2
#!/usr/bin/env python #!/usr/bin/env python
from utils import read_config, Resource, server from utils import read_config, Resource, Server
from flask import Flask, Response from flask import Flask, Response
config = read_config() config = read_config()
app = Flask(__name__) app = Flask(__name__)
server = Server()
@app.route('/<domain>/entities/<path:entity_id>', methods=['GET']) @app.route('/<domain>/entities/<path:entity_id>', methods=['GET'])
def serve(domain, entity_id): def serve(domain, entity_id):
......
...@@ -6,8 +6,8 @@ from concurrent.futures import ThreadPoolExecutor ...@@ -6,8 +6,8 @@ from concurrent.futures import ThreadPoolExecutor
from lxml import etree as ET from lxml import etree as ET
# import traceback # import traceback
from utils import hasher, Signers from utils import hasher
from signers import Signers
# Find all IdP's in edugain metadata # Find all IdP's in edugain metadata
idps = [] idps = []
......
import xmlsec import xmlsec
from signxml import XMLSigner
cert = open("meta.crt").read() cert = "meta.crt"
key = open("meta.key").read() key = "meta.key"
def Signers(signer): def Signers(signer):
def _normal_signer(xml): def _normal_signer(xml):
print("Normal signer") 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): def _test_signer(xml):
print("Test signer") 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): def _foobar_signer(xml):
print("Foobar signer") 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): def _hsm_signer(xml):
print("HSM signer") print("HSM signer")
......
...@@ -151,6 +151,3 @@ class Server: ...@@ -151,6 +151,3 @@ class Server:
def __getitem__(self, domain): def __getitem__(self, domain):
return self.__dict__[domain] return self.__dict__[domain]
server = Server()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment