Commit 0f33dbb2 authored by Martin van Es's avatar Martin van Es
Browse files

Add HSM test script

parent 742425f3
#!/usr/bin/env python
from lxml import etree as ET
import xmlsec
tree = ET.ElementTree(file='metadata/test/md0.xml')
root = tree.getroot()
ns = root.nsmap.copy()
ns['xml'] = 'http://www.w3.org/XML/1998/namespace'
entity_descriptor = root.findall('md:EntityDescriptor', ns)[0]
signed = xmlsec.sign(entity_descriptor, key_spec="pkcs11:///usr/lib/softhsm/libsofthsm2.so/test?pin=secret")
# print(ET.tostring(signed, pretty_print=True).decode())
if xmlsec.verify(signed, 'hsm.crt'):
print("Verified!")
else:
print("Fail")
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