首页 > 解决方案 > Python signxml 自定义命名空间

问题描述

我正在尝试更改在 python 中签署 xml 文档时 signxml 创建的命名空间。目前它使用 ds: 签署签名,我想将其更改为 dsig:

我在用

signed_root = XMLSigner(signature_algorithm='rsa-sha512',method=signxml.methods.envelope,digest_algorithm="sha512").sign(root, key=secret)

我得到类似的东西

<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006 /12/xml-c14n11"/>

但需要它

<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">dsig:SignedInfo<dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12 /xml-c14n11"/>

我确信这与命名空间有关,但找不到在哪里更改它

谢谢

标签: pythonxmlx509xml-signature

解决方案


推荐阅读