RSALib

RSALib

rsalib.decrypt(message: Union[str, bytes], n: int, e: int, d: int, p: int, q: int)bytes

Decrypt MESSAGE with private key specified by N, E, D, P, and Q

rsalib.decryptformed(message: Union[str, bytes], priv_key: rsa.key.PrivateKey)bytes

Decrypt MESSAGE with private key specified by priv_key

rsalib.encrypt(message: Union[str, bytes], n: int, e: int)bytes

Encrypt MESSAGE with public key specified by N and E

rsalib.keygen(size: int = 512)Tuple[int, int, int, int, int, rsa.key.PublicKey, rsa.key.PrivateKey]

Generate a keypair of size SIZE

rsalib.privinfo(priv_key: bytes)Tuple[int, int, int, int, int]

Gets private key info of PRIV_KEY

rsalib.pubinfo(pub_key: bytes)Tuple[int, int]

Gets public key info of PUB_KEY

rsalib.signmessage(message: Union[str, bytes], priv_key: rsa.key.PrivateKey, hash_type: str = 'SHA-1')bytes

Signs MESSAGE with private key in PRIV_KEY and hash type HASH_TYPE

rsalib.verifymessage(message: Union[str, bytes], sig: Union[str, bytes], n: int, e: int)str

Verifies MESSAGE/SIG pair with public key in N + E