Skip to content
Snippets Groups Projects
Commit 0f33dbb2 authored by Martin van Es's avatar Martin van Es
Browse files

Add HSM test script

parent 742425f3
No related branches found
No related tags found
No related merge requests found
#!/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")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment