Register an algorithm for ``alg`` or ``enc`` or ``zip`` of JWE.
(cls, algorithm)
| 55 | |
| 56 | @classmethod |
| 57 | def register_algorithm(cls, algorithm): |
| 58 | """Register an algorithm for ``alg`` or ``enc`` or ``zip`` of JWE.""" |
| 59 | if not algorithm or algorithm.algorithm_type != "JWE": |
| 60 | raise ValueError(f"Invalid algorithm for JWE, {algorithm!r}") |
| 61 | |
| 62 | if algorithm.algorithm_location == "alg": |
| 63 | cls.ALG_REGISTRY[algorithm.name] = algorithm |
| 64 | elif algorithm.algorithm_location == "enc": |
| 65 | cls.ENC_REGISTRY[algorithm.name] = algorithm |
| 66 | elif algorithm.algorithm_location == "zip": |
| 67 | cls.ZIP_REGISTRY[algorithm.name] = algorithm |
| 68 | |
| 69 | def serialize_compact(self, protected, payload, key, sender_key=None): |
| 70 | """Generate a JWE Compact Serialization. |
nothing calls this directly
no outgoing calls
no test coverage detected