Debian Codegraph @

lib/Crypto/Signature/pss.pyi

raw symbols SCIP
1 from typing import Union, Callable, Optional
2 from typing_extensions import Protocol
3
4 from Crypto.PublicKey.RSA import RsaKey
5
6
7 class Hash(Protocol):
8 def digest(self) -> bytes: ...
9 def update(self, bytes) -> None: ...
10
11
12 class HashModule(Protocol):
13 @staticmethod
14 def new(data: Optional[bytes]) -> Hash: ...
15
16
17 MaskFunction = Callable[[bytes, int, Union[Hash, HashModule]], bytes]
18 RndFunction = Callable[[int], bytes]
19
20 class PSS_SigScheme:
21 def __init__(self, key: RsaKey, mgfunc: MaskFunction, saltLen: int, randfunc: RndFunction) -> None: ...
22 def can_sign(self) -> bool: ...
23 def sign(self, msg_hash: Hash) -> bytes: ...
24 def verify(self, msg_hash: Hash, signature: bytes) -> None: ...
25
26
27 MGF1 : MaskFunction
28 def _EMSA_PSS_ENCODE(mhash: Hash, emBits: int, randFunc: RndFunction, mgf:MaskFunction, sLen: int) -> str: ...
29 def _EMSA_PSS_VERIFY(mhash: Hash, em: str, emBits: int, mgf: MaskFunction, sLen: int) -> None: ...
30 def new(rsa_key: RsaKey, **kwargs: Union[MaskFunction, RndFunction, int]) -> PSS_SigScheme: ...