PKCS1_PSS.pyi 867 B

12345678910111213141516171819202122232425262728
  1. from typing import Union, Callable, Optional
  2. from typing_extensions import Protocol
  3. from Crypto.PublicKey.RSA import RsaKey
  4. class Hash(Protocol):
  5. def digest(self) -> bytes: ...
  6. def update(self, bytes) -> None: ...
  7. class HashModule(Protocol):
  8. @staticmethod
  9. def new(data: Optional[bytes]) -> Hash: ...
  10. MaskFunction = Callable[[bytes, int, Union[Hash, HashModule]], bytes]
  11. RndFunction = Callable[[int], bytes]
  12. class PSS_SigScheme:
  13. def __init__(self, key: RsaKey, mgfunc: MaskFunction, saltLen: int, randfunc: RndFunction) -> 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. def new(rsa_key: RsaKey, mgfunc: Optional[MaskFunction]=None, saltLen: Optional[int]=None, randfunc: Optional[RndFunction]=None) -> PSS_SigScheme: ...