Validate that the key's curve matches the expected curve.
(self, key: AllowedECKeys)
| 628 | self.expected_curve = expected_curve |
| 629 | |
| 630 | def _validate_curve(self, key: AllowedECKeys) -> None: |
| 631 | """Validate that the key's curve matches the expected curve.""" |
| 632 | if self.expected_curve is None: |
| 633 | return |
| 634 | |
| 635 | if not isinstance(key.curve, self.expected_curve): |
| 636 | raise InvalidKeyError( |
| 637 | f"The key's curve '{key.curve.name}' does not match the expected " |
| 638 | f"curve '{self.expected_curve.name}' for this algorithm" |
| 639 | ) |
| 640 | |
| 641 | def prepare_key(self, key: AllowedECKeys | str | bytes) -> AllowedECKeys: |
| 642 | if isinstance(key, self._crypto_key_types): |
no test coverage detected