ものづくりのブログ

うちのネコを題材にしたものづくりができたらいいなと思っていろいろ奮闘してます。

暗号化処理で「AttributeError: module 'time' has no attribute 'clock'」というエラーが出て困る

暗号モジュールを使って以下のような処理を実行したら、エラーで困りました。
pythonのバージョンは3.8だったのだが。。。

from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA

message = b'1234567890987654321'
key = RSA.importKey(open('receiver.pem').read())
cipher = PKCS1_OAEP.new(key)
ciphertext = cipher.encrypt(message)

Python 3.8のエラー

AttributeError: module 'time' has no attribute 'clock'

Python 3.7.5だとうまくいくんだよなぁ
f:id:a1026302:20210427220240p:plain