使用模块Crypto.Cipher.PKCS1_OAEP

时间:2019-03-19 22:01:38

标签: python cryptography rsa

这段代码在python 2.7中有效,现在当我试图在python 3中运行它时,抛出了异常:

  

raise NotImplementedError(“使用模块Crypto.Cipher.PKCS1_OAEP   代替”)NotImplementedError:使用模块Crypto.Cipher.PKCS1_OAEP   代替

代码是:

import os
import base64
import ast
import Crypto.Cipher
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from make_keys import *
from decrypt_key import decrypt_key
from Crypto.Cipher import PKCS1_OAEP
...
with open("kljuc.pem", "r") as keyfile:
local_public = keyfile.read()
keyfile.close()
...
local_pub_key = RSA.importKey(local_public)
...
for files in files_to_enc:
    raw_key = os.urandom(32)
    enc_key = local_pub_key.encrypt(raw_key, 32)
    encrypt_file(files, raw_key, enc_key)
print("File locked!\n")

0 个答案:

没有答案