From 256f9ce36fea420d5070503e396b4c8d7c2223c7 Mon Sep 17 00:00:00 2001 From: Krzysztof Jagiello Date: Thu, 17 Mar 2022 23:46:58 +0100 Subject: [PATCH] Add BinaryMemorySignature --- src/zeep/wsse/signature.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/zeep/wsse/signature.py b/src/zeep/wsse/signature.py index c4aec758e..abfb3d50f 100644 --- a/src/zeep/wsse/signature.py +++ b/src/zeep/wsse/signature.py @@ -94,11 +94,7 @@ def __init__( ) -class BinarySignature(Signature): - """Sign given SOAP envelope with WSSE sig using given key file and cert file. - - Place the key information into BinarySecurityElement.""" - +class _BinarySignatureMixin: def apply(self, envelope, headers): key = _make_sign_key(self.key_data, self.cert_data, self.password) _sign_envelope_with_key_binary( @@ -107,6 +103,18 @@ def apply(self, envelope, headers): return envelope, headers +class BinaryMemorySignature(_BinarySignatureMixin, MemorySignature): + """Sign given SOAP envelope with WSSE sig using given key and cert. + + Place the key information into BinarySecurityElement.""" + + +class BinarySignature(_BinarySignatureMixin, Signature): + """Sign given SOAP envelope with WSSE sig using given key file and cert file. + + Place the key information into BinarySecurityElement.""" + + def check_xmlsec_import(): if xmlsec is None: raise ImportError(