2014-07-16 2 views
0

해결하는 방법 :파이썬에서 AttributeError를 이해하고 그것을 내가 오류가 무엇입니까

cipher = PKCS1_OAEP.new(PK_ID) 
    data = cipher.encrypt(data) 

모두 PK_ID 및 데이터는 모두 : 코드의 다음 섹션 내 콘솔에

data = cipher.encrypt(data) 
    File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/PKCS1_OAEP.py", line 133, in encrypt 
    randFunc = self._key._randfunc 
AttributeError: 'str' object has no attribute '_randfunc' 

을 Str of

오류 메시지의 의미는 무엇이며 어떻게이 코드를 해결할 수 있습니까?

답변

1

PKCS1_OAEP.new() 함수는 Crypto.PublicKey.RSA 모듈에서 얻을 수있는 RSA 키 객체를 사용하며 str을 사용하지 않습니다.

+0

그래서 'PKCS1_OAEP.new() 함수에'인스턴스 '를 전달해야합니까? 어쨌든 PK_ID를 이것을 받아 들일 수 있도록 변환 할 것입니까? – user3842234

관련 문제