0
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from base64 import b64decode
def wesocket_Data_Receive(request):
    Data=request.GET.get('ContentData')
    key =open('D:\\WithOldDjango\\AssetManagment\\AssetManagment
    \\blog\\templates\\private.key', 'rb')
    rsakey = RSA.importKey(key.read())
    return HttpResponse(Data)

I am getting the following error while reading the private key using python 3.5 error:"RSA key format is not supported" above is my code

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • Well the error message is clear enough. Is `private.key` formatted correctly? – r3mainer Jul 11 '17 at 14:46
  • @Enayath Ali Please show an example private key. Pycrypto usually supports all common key formats. – Artjom B. Jul 11 '17 at 18:09
  • iam getting the following error message Traceback (most recent call last): File "", line 1, in keyPub = RSA.importKey(keyDER) File "C:\Users\lstadmin\AppData\Local\Programs\Python\Python35\lib\site-packages\Crypto\PublicKey\RSA.py", line 682, in importKey raise ValueError("RSA key format is not supported") ValueError: RSA key format is not supported – Enayath Ali Jul 12 '17 at 05:32

0 Answers0