最近分析一个网站的时候,发现用的是RSA的加密,关键是它不是用私钥解密,而是采用的公钥解密,捣鼓了半天,查阅了资料,才弄出了下面的解决代码 from rsa import PublicKey,transform, core def f(ciphertext, PUBLIC_KEY): public_key = PublicKey.load_pkcs1_openssl_pem(PUBLIC_KEY) ciphertext = transform.bytes2int(ciphertext) decrypted = core.decrypt_int(ciphertext, public_key.e, public_key.n) text = transform.int2bytes(decrypted)[127:] print(base64.b64encode(text)) f(a,key)