Skip to content

Commit a9f767d

Browse files
3bhmvantellingen
authored andcommitted
WSSE: Don't create an empty timestamp node in the Header just so we can sign it!
1 parent 4df3830 commit a9f767d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/zeep/wsse/signature.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,14 @@ def _signature_prepare(envelope, key):
204204
# Insert the Signature node in the wsse:Security header.
205205
security = get_security_header(envelope)
206206
security.insert(0, signature)
207-
security.append(etree.Element(QName(ns.WSU, "Timestamp")))
208207

209208
# Perform the actual signing.
210209
ctx = xmlsec.SignatureContext()
211210
ctx.key = key
212211
_sign_node(ctx, signature, envelope.find(QName(soap_env, "Body")))
213-
_sign_node(ctx, signature, security.find(QName(ns.WSU, "Timestamp")))
212+
timestamp = security.find(QName(ns.WSU, "Timestamp"))
213+
if timestamp != None:
214+
_sign_node(ctx, signature, timestamp)
214215
ctx.sign(signature)
215216

216217
# Place the X509 data inside a WSSE SecurityTokenReference within

0 commit comments

Comments
 (0)