简体   繁体   English

Python signxml 自定义命名空间

[英]Python signxml custom namespace

I am trying to change the namespace that signxml creates when I sign an xml document in python.当我在 python 中签署 xml 文档时,我正在尝试更改 signxml 创建的命名空间。 currently it signs the signature with ds: and I would like to change it to dsig:目前它使用 ds: 签署签名,我想将其更改为 dsig:

I am using我在用

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

and I get something like我得到类似的东西

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

but need it to be但需要它

<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">dsig:SignedInfo<dsig: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"/>

I am sure it is something to do with namespaces but can't find where to change it我确信这与命名空间有关,但找不到在哪里更改它

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM