PythonでランダムなRSAプライベートキーを作成しようとしていますが、エラーメッセージが表示されています。 私が今使っているコードはthisです。以前作成したスレッドですが、うまくいきません。Python 3でプライベートキーを作成する際にエラーが発生するRSA
コード:
from Crypto import Random
from Crypto.PublicKey import RSA
def random_generator():
return Random.new().read(32)
private_key = RSA.generate(1024, random_generator)
print(str(private_key))
エラーメッセージ:
Traceback (most recent call last):
File "/home/simon/Python/Projects/FileServer/encrypt.py", line 7, in <module>
private_key = RSA.generate(1024, random_generator)
File "/usr/lib/python3/dist-packages/Crypto/PublicKey/RSA.py", line 508, in generate
obj = _RSA.generate_py(bits, rf, progress_func, e) # TODO: Don't use legacy _RSA module
File "/usr/lib/python3/dist-packages/Crypto/PublicKey/_RSA.py", line 50, in generate_py
p = pubkey.getStrongPrime(bits>>1, obj.e, 1e-12, randfunc)
File "/usr/lib/python3/dist-packages/Crypto/Util/number.py", line 265, in getStrongPrime
randfunc)
TypeError: random_generator() takes 0 positional arguments but 1 was given
可能な二重にRSAプライベートキーを作成しながら、 python](http://stackoverflow.com/questions/42175763/error-while-creating-private-key-with-rsa-in-python) –
あなたの質問を再編集しないでください。 –