Python 3.x Crypto不支持python 3.x?

Python 3.x Crypto不支持python 3.x?,python-3.x,pycrypto,Python 3.x,Pycrypto,使用python3.x时,请运行以下代码: with open('rsa_public_key.pem') as f: key = f.read() rsakey = RSA.importKey(key) cipher = Cipher_pkcs1_v1_5.new(rsakey) cipher_text = base64.b64encode(cipher.encrypt(aes_key)) str1 = cipher_text 它将引发一个错误

使用python3.x时,请运行以下代码:

    with open('rsa_public_key.pem') as f:
    key = f.read()
    rsakey = RSA.importKey(key)
    cipher = Cipher_pkcs1_v1_5.new(rsakey)
    cipher_text = base64.b64encode(cipher.encrypt(aes_key))
    str1 = cipher_text
它将引发一个错误:

  File "de_test.py", line 81, in get_login_data_inputPostString
cipher_text = base64.b64encode(cipher.encrypt(aes_key))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Crypto/Cipher/PKCS1_v1_5.py", line 137, in encrypt
em = b('\x00\x02') + ps + bchr(0x00) + message
TypeError: can't concat str to bytes
但当我使用Python2.6时,它将通过


那么crypto不支持Python3.x

没有看到
aes_密钥
,看起来您正试图传递一个
str
对象,您应该将
字节
对象传递给
加密()