| 1 | from typing import Union, Optional, Callable |
| 2 | from typing_extensions import Protocol |
| 3 | |
| 4 | from Crypto.PublicKey.DSA import DsaKey |
| 5 | from Crypto.PublicKey.ECC import EccKey |
| 6 | |
| 7 | class Hash(Protocol): |
| 8 | def digest(self) -> bytes: ... |
| 9 | |
| 10 | __all__ = ['new'] |
| 11 | |
| 12 | class DssSigScheme: |
| 13 | def __init__(self, key: Union[DsaKey, EccKey], encoding: str, order: int) -> None: ... |
| 14 | def can_sign(self) -> bool: ... |
| 15 | def sign(self, msg_hash: Hash) -> bytes: ... |
| 16 | def verify(self, msg_hash: Hash, signature: bytes) -> bool: ... |
| 17 | |
| 18 | class DeterministicDsaSigScheme(DssSigScheme): |
| 19 | def __init__(self, key, encoding, order, private_key) -> None: ... |
| 20 | |
| 21 | class FipsDsaSigScheme(DssSigScheme): |
| 22 | def __init__(self, key: DsaKey, encoding: str, order: int, randfunc: Callable) -> None: ... |
| 23 | |
| 24 | class FipsEcDsaSigScheme(DssSigScheme): |
| 25 | def __init__(self, key: EccKey, encoding: str, order: int, randfunc: Callable) -> None: ... |
| 26 | |
| 27 | def new(key: Union[DsaKey, EccKey], mode: str, encoding: Optional[str]='binary', randfunc: Optional[Callable]=None) -> Union[DeterministicDsaSigScheme, FipsDsaSigScheme, FipsEcDsaSigScheme]: ... |