DSS.pyi 1.1 KB

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