Skip to content

Commit

Permalink
Update RSA typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Jan 7, 2024
1 parent 954470d commit be2262e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions lib/Crypto/PublicKey/RSA.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Callable, Union, Tuple, Optional
from typing import Callable, Union, Tuple, Optional, overload, Literal

from Crypto.Math.Numbers import Integer
from Crypto.IO._PBES import ProtParams

__all__ = ['generate', 'construct', 'import_key',
'RsaKey', 'oid']
Expand Down Expand Up @@ -38,8 +39,24 @@ class RsaKey(object):
def __getstate__(self) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def export_key(self, format: Optional[str]="PEM", passphrase: Optional[str]=None, pkcs: Optional[int]=1,
protection: Optional[str]=None, randfunc: Optional[RNG]=None) -> bytes: ...

@overload
def export_key(self,
format: Optional[str]="PEM",
passphrase: Optional[str]=None,
pkcs: Optional[int]=1,
protection: Optional[str]=None,
randfunc: Optional[RNG]=None
) -> bytes: ...
@overload
def export_key(self, *,
format: Optional[str]="PEM",
passphrase: str,
pkcs: Literal[8],
protection: str,
randfunc: Optional[RNG]=None,
prot_params: ProtParams,
) -> bytes: ...

# Backward compatibility
exportKey = export_key
Expand Down

0 comments on commit be2262e

Please sign in to comment.