Skip to content

Commit 80cab29

Browse files
feat(wsse): add pure-Python WS-Security signing (no xmlsec dependency)
Add `zeep.wsse.crypto` module as a drop-in alternative to the existing xmlsec-based `zeep.wsse.signature` module. Uses the `cryptography` library instead of the C-based `xmlsec`, making installation straightforward on all platforms. New capabilities beyond the xmlsec-based module: - No C library dependency (pure Python via `cryptography` + `lxml`) - PKCS#12 (.p12/.pfx) key loading support - Configurable signed parts (Body, Timestamp, UsernameToken, BinarySecurityToken, or any element with wsu:Id) - Per-reference inclusive namespace prefixes for exclusive C14N - Mixed digest/signature algorithms (e.g. SHA-256 digests + RSA-SHA1) Classes: CryptoSignature, CryptoBinarySignature, CryptoMemorySignature, CryptoBinaryMemorySignature, PKCS12Signature Install with: pip install zeep[crypto] Closes mvantellingen#1357, relates to mvantellingen#1419, mvantellingen#1428, mvantellingen#1363, mvantellingen#1318 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 368861c commit 80cab29

7 files changed

Lines changed: 1446 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async = [
5757
"packaging",
5858
]
5959
xmlsec = ["xmlsec>=0.6.1"]
60+
crypto = ["cryptography>=3.0"]
6061

6162
[build-system]
6263
requires = ["setuptools>=40.6.0", "wheel"]

src/zeep/wsse/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,31 @@
22
from .signature import BinarySignature, MemorySignature, Signature
33
from .username import UsernameToken
44

5+
try:
6+
from .crypto import (
7+
CryptoBinaryMemorySignature,
8+
CryptoBinarySignature,
9+
CryptoMemorySignature,
10+
CryptoSignature,
11+
PKCS12Signature,
12+
)
13+
except ImportError:
14+
# cryptography not installed — pure-python signing unavailable
15+
CryptoBinaryMemorySignature = None
16+
CryptoBinarySignature = None
17+
CryptoMemorySignature = None
18+
CryptoSignature = None
19+
PKCS12Signature = None
20+
521
__all__ = [
622
"Compose",
723
"BinarySignature",
824
"MemorySignature",
925
"Signature",
1026
"UsernameToken",
27+
"CryptoBinaryMemorySignature",
28+
"CryptoBinarySignature",
29+
"CryptoMemorySignature",
30+
"CryptoSignature",
31+
"PKCS12Signature",
1132
]

0 commit comments

Comments
 (0)