Bases: CipherSuiteBase
Skeleton suite for XAdES policy.
suite_id
Source code in swarmauri_cipher_suite_xades/XadesCipherSuite.py
| def suite_id(self) -> str:
return "xades"
|
supports
Source code in swarmauri_cipher_suite_xades/XadesCipherSuite.py
| def supports(self) -> Mapping[CipherOp, Iterable[Alg]]:
return {"sign": _SIG, "verify": _SIG}
|
default_alg
default_alg(op, *, for_key=None)
Source code in swarmauri_cipher_suite_xades/XadesCipherSuite.py
| def default_alg(self, op: CipherOp, *, for_key: Optional[KeyRef] = None) -> Alg:
return "RSA-PSS-SHA256"
|
features
Source code in swarmauri_cipher_suite_xades/XadesCipherSuite.py
36
37
38
39
40
41
42
43
44 | def features(self) -> Features:
return {
"suite": "xades",
"version": 1,
"dialects": {"xmlsig": list(_SIG)},
"constraints": {"canonicalization": list(_C14N)},
"ops": {"sign": {"default": "RSA-PSS-SHA256", "allowed": list(_SIG)}},
"compliance": {"fips": False},
}
|
normalize
normalize(
*, op, alg=None, key=None, params=None, dialect=None
)
Source code in swarmauri_cipher_suite_xades/XadesCipherSuite.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 | def normalize(
self,
*,
op: CipherOp,
alg: Optional[Alg] = None,
key: Optional[KeyRef] = None,
params: Optional[ParamMapping] = None,
dialect: Optional[str] = None,
) -> NormalizedDescriptor:
allowed = set(self.supports().get(op, ()))
chosen = alg or self.default_alg(op)
if chosen not in allowed:
raise ValueError(f"{chosen=} not supported for {op=}")
return {
"op": op,
"alg": chosen,
"dialect": "xmlsig" if dialect is None else dialect,
"mapped": {"xmlsig": chosen, "provider": chosen},
"params": dict(params or {}),
"constraints": {},
"policy": self.policy(),
}
|