signxml
signxml copied to clipboard
How to add <X509SubjectName> tag in <X509Data> in KeyInfo?
As of now, when I use sign method, I get the xml output as
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate></ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
I want output as
<ds:KeyInfo>
<ds:X509Data>
<ds:X509SubjectName></ds:X509SubjectName>
<ds:X509Certificate></ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
Is this possible in the current version of library?
Yes, I have done this. You can you use parameter key_info and pass in a etree.Element.
The way to create this element is simple, you need to create an element with a namespace. Then add SubElement to this element and then finally pass it as value to the argument.
Eg:
I'll link you to a stackoverflow answer where you can learn how to create element with a namespace.
signed_root.key(cert=cert, key=key, key_info=custom)
I need to do this, any of you can share some example? @rahul-s-bhatt @rohts-patil