RSA.pyi 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from typing import Callable, Union, Tuple, Optional
  2. __all__ = ['generate', 'construct', 'import_key',
  3. 'RsaKey', 'oid']
  4. class RsaKey(object):
  5. def __init__(self, **kwargs: int) -> None: ...
  6. @property
  7. def n(self) -> int: ...
  8. @property
  9. def e(self) -> int: ...
  10. @property
  11. def d(self) -> int: ...
  12. @property
  13. def p(self) -> int: ...
  14. @property
  15. def q(self) -> int: ...
  16. @property
  17. def u(self) -> int: ...
  18. def size_in_bits(self) -> int: ...
  19. def size_in_bytes(self) -> int: ...
  20. def has_private(self) -> bool: ...
  21. def can_encrypt(self) -> bool: ... # legacy
  22. def can_sign(self) -> bool:... # legacy
  23. def publickey(self) -> RsaKey: ...
  24. def __eq__(self, other: object) -> bool: ...
  25. def __ne__(self, other: object) -> bool: ...
  26. def __getstate__(self) -> None: ...
  27. def __repr__(self) -> str: ...
  28. def __str__(self) -> str: ...
  29. def export_key(self, format: Optional[str]="PEM", passphrase: Optional[str]=None, pkcs: Optional[int]=1,
  30. protection: Optional[str]=None, randfunc: Optional[Callable]=None) -> bytes: ...
  31. # Backward compatibility
  32. exportKey = export_key
  33. def generate(bits: int, randfunc: Optional[Callable]=None, e: Optional[int]=65537) -> RsaKey: ...
  34. def construct(rsa_components: Union[Tuple[int, int], # n, e
  35. Tuple[int, int, int], # n, e, d
  36. Tuple[int, int, int, int, int], # n, e, d, p, q
  37. Tuple[int, int, int, int, int, int]], # n, e, d, p, q, crt_q
  38. consistency_check: Optional[bool]=True) -> RsaKey: ...
  39. def import_key(extern_key: Union[str, bytes], passphrase: Optional[str]=None) -> RsaKey: ...
  40. # Backward compatibility
  41. importKey = import_key
  42. oid: str