crypto: delete stubs (#4606)

Crypto is a package that comes from pycrypto, which was last updated in
2013. It proudly supports Python 2.1 through 3.3.
There's a near drop-in replacement from pycryptodome, which seems well
maintained. pycryptodome has provided stubs for the last two years.

I propose we get rid of the whole thing. pycrypto seems about as dead as
software can get. These stubs have received two fixes since 2016.

https://github.com/python/typeshed/issues/2952
https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
https://github.com/Legrandin/pycryptodome/blob/master/Changelog.rst#371-25-november-2018

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-10-04 13:05:47 -07:00
committed by GitHub
parent d34a45daa9
commit cca6e53d86
55 changed files with 0 additions and 748 deletions

View File

@@ -1,20 +0,0 @@
from typing import Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class AESCipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> AESCipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: int

View File

@@ -1,20 +0,0 @@
from typing import Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class RC2Cipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> RC2Cipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: int

View File

@@ -1,15 +0,0 @@
from typing import Text, Union
__revision__: str
class ARC4Cipher:
block_size: int
key_size: int
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def encrypt(self, plaintext): ...
def decrypt(self, ciphertext): ...
def new(key: Union[bytes, Text], *args, **kwargs) -> ARC4Cipher: ...
block_size: int
key_size: int

View File

@@ -1,20 +0,0 @@
from typing import Any, Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class BlowfishCipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> BlowfishCipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: Any

View File

@@ -1,20 +0,0 @@
from typing import Any, Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class CAST128Cipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> CAST128Cipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: Any

View File

@@ -1,20 +0,0 @@
from typing import Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class DESCipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> DESCipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: int

View File

@@ -1,20 +0,0 @@
from typing import Any, Text, Union
from .blockalgo import BlockAlgo
__revision__: str
class DES3Cipher(BlockAlgo):
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> DES3Cipher: ...
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
block_size: int
key_size: Any

View File

@@ -1,12 +0,0 @@
from typing import Any, Optional, Text, Union
from Crypto.PublicKey.RSA import _RSAobj
class PKCS1OAEP_Cipher:
def __init__(self, key: _RSAobj, hashAlgo: Any, mgfunc: Any, label: Any) -> None: ...
def can_encrypt(self): ...
def can_decrypt(self): ...
def encrypt(self, message: Union[bytes, Text]) -> bytes: ...
def decrypt(self, ct: bytes) -> bytes: ...
def new(key: _RSAobj, hashAlgo: Optional[Any] = ..., mgfunc: Optional[Any] = ..., label: Any = ...) -> PKCS1OAEP_Cipher: ...

View File

@@ -1,13 +0,0 @@
from typing import Any, Text, Union
from Crypto.PublicKey.RSA import _RSAobj
class PKCS115_Cipher:
def __init__(self, key: _RSAobj) -> None: ...
def can_encrypt(self) -> bool: ...
def can_decrypt(self) -> bool: ...
rf: Any
def encrypt(self, message: Union[bytes, Text]) -> bytes: ...
def decrypt(self, ct: bytes, sentinel: Any) -> bytes: ...
def new(key: _RSAobj) -> PKCS115_Cipher: ...

View File

@@ -1,15 +0,0 @@
from typing import Text, Union
__revision__: str
class XORCipher:
block_size: int
key_size: int
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def encrypt(self, plaintext: Union[bytes, Text]) -> bytes: ...
def decrypt(self, ciphertext: bytes) -> bytes: ...
def new(key: Union[bytes, Text], *args, **kwargs) -> XORCipher: ...
block_size: int
key_size: int

View File

@@ -1,11 +0,0 @@
# Names in __all__ with no definition:
# AES
# ARC2
# ARC4
# Blowfish
# CAST
# DES
# DES3
# PKCS1_OAEP
# PKCS1_v1_5
# XOR

View File

@@ -1,17 +0,0 @@
from typing import Any, Text, Union
MODE_ECB: int
MODE_CBC: int
MODE_CFB: int
MODE_PGP: int
MODE_OFB: int
MODE_CTR: int
MODE_OPENPGP: int
class BlockAlgo:
mode: int
block_size: int
IV: Any
def __init__(self, factory: Any, key: Union[bytes, Text], *args, **kwargs) -> None: ...
def encrypt(self, plaintext: Union[bytes, Text]) -> bytes: ...
def decrypt(self, ciphertext: bytes) -> bytes: ...

View File

@@ -1,16 +0,0 @@
from typing import Any, Optional
digest_size: Any
class HMAC:
digest_size: Any
digestmod: Any
outer: Any
inner: Any
def __init__(self, key, msg: Optional[Any] = ..., digestmod: Optional[Any] = ...) -> None: ...
def update(self, msg): ...
def copy(self): ...
def digest(self): ...
def hexdigest(self): ...
def new(key, msg: Optional[Any] = ..., digestmod: Optional[Any] = ...): ...

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class MD2Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class MD4Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class MD5Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class RIPEMD160Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class SHA1Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class SHA224Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class SHA256Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class SHA384Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,14 +0,0 @@
from typing import Any, Optional
from Crypto.Hash.hashalgo import HashAlgo
class SHA512Hash(HashAlgo):
oid: Any
digest_size: int
block_size: int
def __init__(self, data: Optional[Any] = ...) -> None: ...
def new(self, data: Optional[Any] = ...): ...
def new(data: Optional[Any] = ...): ...
digest_size: Any

View File

@@ -1,11 +0,0 @@
# Names in __all__ with no definition:
# HMAC
# MD2
# MD4
# MD5
# RIPEMD
# SHA
# SHA224
# SHA256
# SHA384
# SHA512

View File

@@ -1,11 +0,0 @@
from typing import Any, Optional
class HashAlgo:
digest_size: Any
block_size: Any
def __init__(self, hashFactory, data: Optional[Any] = ...) -> None: ...
def update(self, data): ...
def digest(self): ...
def hexdigest(self): ...
def copy(self): ...
def new(self, data: Optional[Any] = ...): ...

View File

@@ -1,10 +0,0 @@
from typing import Any, Optional
__revision__: str
def isInt(x): ...
class AllOrNothing:
def __init__(self, ciphermodule, mode: Optional[Any] = ..., IV: Optional[Any] = ...) -> None: ...
def digest(self, text): ...
def undigest(self, blocks): ...

View File

@@ -1,5 +0,0 @@
__revision__: str
class Chaff:
def __init__(self, factor: float = ..., blocksper: int = ...) -> None: ...
def chaff(self, blocks): ...

View File

@@ -1,8 +0,0 @@
from typing import Any, Optional
from Crypto.Hash import SHA as SHA1
__revision__: str
def PBKDF1(password, salt, dkLen, count: int = ..., hashAlgo: Optional[Any] = ...): ...
def PBKDF2(password, salt, dkLen: int = ..., count: int = ..., prf: Optional[Any] = ...): ...

View File

@@ -1,4 +0,0 @@
# Names in __all__ with no definition:
# AllOrNothing
# Chaffing
# KDF

View File

@@ -1,28 +0,0 @@
from typing import Any, Optional
from .pubkey import pubkey
class _DSAobj(pubkey):
keydata: Any
implementation: Any
key: Any
def __init__(self, implementation, key) -> None: ...
def __getattr__(self, attrname): ...
def sign(self, M, K): ...
def verify(self, M, signature): ...
def has_private(self): ...
def size(self): ...
def can_blind(self): ...
def can_encrypt(self): ...
def can_sign(self): ...
def publickey(self): ...
class DSAImplementation:
error: Any
def __init__(self, **kwargs) -> None: ...
def generate(self, bits, randfunc: Optional[Any] = ..., progress_func: Optional[Any] = ...): ...
def construct(self, tup): ...
generate: Any
construct: Any
error: Any

View File

@@ -1,19 +0,0 @@
from typing import Any, Optional
from Crypto.PublicKey.pubkey import * # noqa: F403
from Crypto.PublicKey.pubkey import pubkey
class error(Exception): ...
def generate(bits, randfunc, progress_func: Optional[Any] = ...): ...
def construct(tup): ...
class ElGamalobj(pubkey):
keydata: Any
def encrypt(self, plaintext, K): ...
def decrypt(self, ciphertext): ...
def sign(self, M, K): ...
def verify(self, M, signature): ...
def size(self): ...
def has_private(self): ...
def publickey(self): ...

View File

@@ -1,33 +0,0 @@
from typing import Any, Optional, Text, Union
from .pubkey import pubkey
class _RSAobj(pubkey):
keydata: Any
implementation: Any
key: Any
def __init__(self, implementation, key, randfunc: Optional[Any] = ...) -> None: ...
def __getattr__(self, attrname): ...
def encrypt(self, plaintext, K): ...
def decrypt(self, ciphertext): ...
def sign(self, M, K): ...
def verify(self, M, signature): ...
def has_private(self): ...
def size(self): ...
def can_blind(self): ...
def can_encrypt(self): ...
def can_sign(self): ...
def publickey(self): ...
def exportKey(self, format: str = ..., passphrase: Optional[Any] = ..., pkcs: int = ...): ...
class RSAImplementation:
error: Any
def __init__(self, **kwargs) -> None: ...
def generate(self, bits, randfunc: Optional[Any] = ..., progress_func: Optional[Any] = ..., e: int = ...): ...
def construct(self, tup): ...
def importKey(self, externKey: Any, passphrase: Union[None, bytes, Text] = ...) -> _RSAobj: ...
generate: Any
construct: Any
importKey: Any
error: Any

View File

@@ -1,4 +0,0 @@
# Names in __all__ with no definition:
# DSA
# ElGamal
# RSA

View File

@@ -1,21 +0,0 @@
from Crypto.Util.number import * # noqa: F403
__revision__: str
class pubkey:
def __init__(self) -> None: ...
def encrypt(self, plaintext, K): ...
def decrypt(self, ciphertext): ...
def sign(self, M, K): ...
def verify(self, M, signature): ...
def validate(self, M, signature): ...
def blind(self, M, B): ...
def unblind(self, M, B): ...
def can_sign(self): ...
def can_encrypt(self): ...
def can_blind(self): ...
def size(self): ...
def has_private(self): ...
def publickey(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...

View File

@@ -1,25 +0,0 @@
from typing import Any
__revision__: str
class FortunaPool:
digest_size: Any
def __init__(self) -> None: ...
def append(self, data): ...
def digest(self): ...
def hexdigest(self): ...
length: int
def reset(self): ...
def which_pools(r): ...
class FortunaAccumulator:
min_pool_size: int
reseed_interval: float
reseed_count: int
generator: Any
last_reseed: Any
pools: Any
def __init__(self) -> None: ...
def random_data(self, bytes): ...
def add_random_event(self, source_number, pool_number, data): ...

View File

@@ -1,16 +0,0 @@
from typing import Any
__revision__: str
class AESGenerator:
block_size: Any
key_size: int
max_blocks_per_request: Any
counter: Any
key: Any
block_size_shift: Any
blocks_per_key: Any
max_bytes_per_request: Any
def __init__(self) -> None: ...
def reseed(self, seed): ...
def pseudo_random_data(self, bytes): ...

View File

@@ -1,13 +0,0 @@
from typing import Any, Optional
class _SHAd256:
digest_size: Any
def __init__(self, internal_api_check, sha256_hash_obj) -> None: ...
def copy(self): ...
def digest(self): ...
def hexdigest(self): ...
def update(self, data): ...
digest_size: Any
def new(data: Optional[Any] = ...): ...

View File

@@ -1 +0,0 @@
__revision__: str

View File

@@ -1,5 +0,0 @@
from .rng_base import BaseRNG
class PythonOSURandomRNG(BaseRNG):
name: str
def __init__(self) -> None: ...

View File

@@ -1,7 +0,0 @@
from typing import Any, Optional
from .rng_base import BaseRNG
class DevURandomRNG(BaseRNG):
name: str
def __init__(self, devname: Optional[Any] = ...) -> None: ...

View File

@@ -1,11 +0,0 @@
__revision__: str
class BaseRNG:
closed: bool
def __init__(self) -> None: ...
def __del__(self): ...
def __enter__(self): ...
def __exit__(self): ...
def close(self): ...
def flush(self): ...
def read(self, N: int = ...): ...

View File

@@ -1,5 +0,0 @@
from typing import Any
def new(*args: Any, **kwargs: Any): ...
def atfork() -> None: ...
def get_random_bytes(n: int) -> bytes: ...

View File

@@ -1,19 +0,0 @@
from typing import Any, List, Optional, Sequence, TypeVar
_T = TypeVar("_T")
class StrongRandom:
def __init__(self, rng: Optional[Any] = ..., randfunc: Optional[Any] = ...) -> None: ...
def getrandbits(self, k: int) -> int: ...
def randrange(self, start: int, stop: int = ..., step: int = ...) -> int: ...
def randint(self, a: int, b: int) -> int: ...
def choice(self, seq: Sequence[_T]) -> _T: ...
def shuffle(self, x: Sequence[Any]): ...
def sample(self, population: Sequence[_T], k: int) -> List[_T]: ...
def getrandbits(k: int) -> int: ...
def randrange(start: int, stop: int = ..., step: int = ...) -> int: ...
def randint(a: int, b: int) -> int: ...
def choice(seq: Sequence[_T]) -> _T: ...
def shuffle(x: Sequence[Any]): ...
def sample(population: Sequence[_T], k: int) -> List[_T]: ...

View File

@@ -1,9 +0,0 @@
from typing import Any, Optional
class PSS_SigScheme:
def __init__(self, key, mgfunc, saltLen) -> None: ...
def can_sign(self): ...
def sign(self, mhash): ...
def verify(self, mhash, S): ...
def new(key, mgfunc: Optional[Any] = ..., saltLen: Optional[Any] = ...): ...

View File

@@ -1,7 +0,0 @@
class PKCS115_SigScheme:
def __init__(self, key) -> None: ...
def can_sign(self): ...
def sign(self, mhash): ...
def verify(self, mhash, S): ...
def new(key): ...

View File

@@ -1,3 +0,0 @@
# Names in __all__ with no definition:
# PKCS1_PSS
# PKCS1_v1_5

View File

@@ -1,12 +0,0 @@
from typing import Any
def new(
nbits,
prefix: Any = ...,
suffix: Any = ...,
initial_value: int = ...,
overflow: int = ...,
little_endian: bool = ...,
allow_wraparound: bool = ...,
disable_shortcut: bool = ...,
): ...

View File

@@ -1,9 +0,0 @@
from typing import Any
__revision__: str
binary: Any
def key_to_english(key): ...
def english_to_key(s): ...
wordlist: Any

View File

@@ -1,6 +0,0 @@
# Names in __all__ with no definition:
# RFC1751
# asn1
# number
# randpool
# strxor

View File

@@ -1,45 +0,0 @@
from typing import Any, Optional
class DerObject:
typeTags: Any
typeTag: Any
payload: Any
def __init__(self, ASN1Type: Optional[Any] = ..., payload: Any = ...) -> None: ...
def isType(self, ASN1Type): ...
def encode(self): ...
def decode(self, derEle, noLeftOvers: int = ...): ...
class DerInteger(DerObject):
value: Any
def __init__(self, value: int = ...) -> None: ...
payload: Any
def encode(self): ...
def decode(self, derEle, noLeftOvers: int = ...): ...
class DerSequence(DerObject):
def __init__(self, startSeq: Optional[Any] = ...) -> None: ...
def __delitem__(self, n): ...
def __getitem__(self, n): ...
def __setitem__(self, key, value): ...
def __setslice__(self, i, j, sequence): ...
def __delslice__(self, i, j): ...
def __getslice__(self, i, j): ...
def __len__(self): ...
def append(self, item): ...
def hasInts(self): ...
def hasOnlyInts(self): ...
payload: Any
def encode(self): ...
def decode(self, derEle, noLeftOvers: int = ...): ...
class DerOctetString(DerObject):
payload: Any
def __init__(self, value: Any = ...) -> None: ...
def decode(self, derEle, noLeftOvers: int = ...): ...
class DerNull(DerObject):
def __init__(self) -> None: ...
class DerObjectId(DerObject):
def __init__(self) -> None: ...
def decode(self, derEle, noLeftOvers: int = ...): ...

View File

@@ -1,22 +0,0 @@
from typing import Any, Optional
from warnings import warn as _warn
__revision__: str
bignum: Any
def size(N): ...
def getRandomNumber(N, randfunc: Optional[Any] = ...): ...
def getRandomInteger(N, randfunc: Optional[Any] = ...): ...
def getRandomRange(a, b, randfunc: Optional[Any] = ...): ...
def getRandomNBitInteger(N, randfunc: Optional[Any] = ...): ...
def GCD(x, y): ...
def inverse(u, v): ...
def getPrime(N, randfunc: Optional[Any] = ...): ...
def getStrongPrime(N, e: int = ..., false_positive_prob: float = ..., randfunc: Optional[Any] = ...): ...
def isPrime(N, false_positive_prob: float = ..., randfunc: Optional[Any] = ...): ...
def long_to_bytes(n, blocksize: int = ...): ...
def bytes_to_long(s): ...
def long2str(n, blocksize: int = ...): ...
def str2long(s): ...
sieve_base: Any

View File

@@ -1,18 +0,0 @@
from typing import Any, Optional
__revision__: str
class RandomPool:
bytes: Any
bits: Any
entropy: Any
def __init__(
self, numbytes: int = ..., cipher: Optional[Any] = ..., hash: Optional[Any] = ..., file: Optional[Any] = ...
) -> None: ...
def get_bytes(self, N): ...
def randomize(self, N: int = ...): ...
def stir(self, s: str = ...): ...
def stir_n(self, N: int = ...): ...
def add_event(self, s: str = ...): ...
def getBytes(self, N): ...
def addEvent(self, event, s: str = ...): ...

View File

@@ -1,2 +0,0 @@
def strxor(*args, **kwargs): ...
def strxor_c(*args, **kwargs): ...

View File

@@ -1,7 +0,0 @@
# Names in __all__ with no definition:
# Cipher
# Hash
# Protocol
# PublicKey
# Signature
# Util

View File

@@ -1,7 +0,0 @@
class CryptoWarning(Warning): ...
class CryptoDeprecationWarning(DeprecationWarning, CryptoWarning): ...
class CryptoRuntimeWarning(RuntimeWarning, CryptoWarning): ...
class RandomPool_DeprecationWarning(CryptoDeprecationWarning): ...
class ClockRewindWarning(CryptoRuntimeWarning): ...
class GetRandomNumber_DeprecationWarning(CryptoDeprecationWarning): ...
class PowmInsecureWarning(CryptoRuntimeWarning): ...