AES.pyi 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. from typing import ByteString, Dict, Optional, Tuple, Union, overload
  2. from typing_extensions import Literal
  3. from Cryptodome.Cipher._mode_ecb import EcbMode
  4. from Cryptodome.Cipher._mode_cbc import CbcMode
  5. from Cryptodome.Cipher._mode_cfb import CfbMode
  6. from Cryptodome.Cipher._mode_ofb import OfbMode
  7. from Cryptodome.Cipher._mode_ctr import CtrMode
  8. from Cryptodome.Cipher._mode_openpgp import OpenPgpMode
  9. from Cryptodome.Cipher._mode_ccm import CcmMode
  10. from Cryptodome.Cipher._mode_eax import EaxMode
  11. from Cryptodome.Cipher._mode_gcm import GcmMode
  12. from Cryptodome.Cipher._mode_siv import SivMode
  13. from Cryptodome.Cipher._mode_ocb import OcbMode
  14. MODE_ECB: Literal[1]
  15. MODE_CBC: Literal[2]
  16. MODE_CFB: Literal[3]
  17. MODE_OFB: Literal[5]
  18. MODE_CTR: Literal[6]
  19. MODE_OPENPGP: Literal[7]
  20. MODE_CCM: Literal[8]
  21. MODE_EAX: Literal[9]
  22. MODE_SIV: Literal[10]
  23. MODE_GCM: Literal[11]
  24. MODE_OCB: Literal[12]
  25. # MODE_ECB
  26. @overload
  27. def new(key: ByteString,
  28. mode: Literal[1],
  29. use_aesni : bool = ...) -> \
  30. EcbMode: ...
  31. # MODE_CBC
  32. @overload
  33. def new(key: ByteString,
  34. mode: Literal[2],
  35. iv : Optional[ByteString] = ...,
  36. use_aesni : bool = ...) -> \
  37. CbcMode: ...
  38. @overload
  39. def new(key: ByteString,
  40. mode: Literal[2],
  41. IV : Optional[ByteString] = ...,
  42. use_aesni : bool = ...) -> \
  43. CbcMode: ...
  44. # MODE_CFB
  45. @overload
  46. def new(key: ByteString,
  47. mode: Literal[3],
  48. iv : Optional[ByteString] = ...,
  49. segment_size : int = ...,
  50. use_aesni : bool = ...) -> \
  51. CfbMode: ...
  52. @overload
  53. def new(key: ByteString,
  54. mode: Literal[3],
  55. IV : Optional[ByteString] = ...,
  56. segment_size : int = ...,
  57. use_aesni : bool = ...) -> \
  58. CfbMode: ...
  59. # MODE_OFB
  60. @overload
  61. def new(key: ByteString,
  62. mode: Literal[5],
  63. iv : Optional[ByteString] = ...,
  64. use_aesni : bool = ...) -> \
  65. OfbMode: ...
  66. @overload
  67. def new(key: ByteString,
  68. mode: Literal[5],
  69. IV : Optional[ByteString] = ...,
  70. use_aesni : bool = ...) -> \
  71. OfbMode: ...
  72. # MODE_CTR
  73. @overload
  74. def new(key: ByteString,
  75. mode: Literal[6],
  76. nonce : Optional[ByteString] = ...,
  77. initial_value : Union[int, ByteString] = ...,
  78. counter : Dict = ...,
  79. use_aesni : bool = ...) -> \
  80. CtrMode: ...
  81. # MODE_OPENPGP
  82. @overload
  83. def new(key: ByteString,
  84. mode: Literal[7],
  85. iv : Optional[ByteString] = ...,
  86. use_aesni : bool = ...) -> \
  87. OpenPgpMode: ...
  88. @overload
  89. def new(key: ByteString,
  90. mode: Literal[7],
  91. IV : Optional[ByteString] = ...,
  92. use_aesni : bool = ...) -> \
  93. OpenPgpMode: ...
  94. # MODE_CCM
  95. @overload
  96. def new(key: ByteString,
  97. mode: Literal[8],
  98. nonce : Optional[ByteString] = ...,
  99. mac_len : int = ...,
  100. assoc_len : int = ...,
  101. use_aesni : bool = ...) -> \
  102. CcmMode: ...
  103. # MODE_EAX
  104. @overload
  105. def new(key: ByteString,
  106. mode: Literal[9],
  107. nonce : Optional[ByteString] = ...,
  108. mac_len : int = ...,
  109. use_aesni : bool = ...) -> \
  110. EaxMode: ...
  111. # MODE_GCM
  112. @overload
  113. def new(key: ByteString,
  114. mode: Literal[10],
  115. nonce : Optional[ByteString] = ...,
  116. use_aesni : bool = ...) -> \
  117. SivMode: ...
  118. # MODE_SIV
  119. @overload
  120. def new(key: ByteString,
  121. mode: Literal[11],
  122. nonce : Optional[ByteString] = ...,
  123. mac_len : int = ...,
  124. use_aesni : bool = ...) -> \
  125. GcmMode: ...
  126. # MODE_OCB
  127. @overload
  128. def new(key: ByteString,
  129. mode: Literal[12],
  130. nonce : Optional[ByteString] = ...,
  131. mac_len : int = ...,
  132. use_aesni : bool = ...) -> \
  133. OcbMode: ...
  134. block_size: int
  135. key_size: Tuple[int, int, int]