![]() ![]() I was thinking maybe I need to pad like in AES, but I am not too sure. I am not too sure how to fix the length error. I was wondering more so if I am on the right track, or completely going off the rails. Key = RSA.construct(rsa_components=(n,e,d,p,q)) My code currently looks like: from Crypto.PublicKey import RSA rsamodulus data 'publickeymod' rsaexponent data 'publickeyexp' rsatimestamp data 'timestamp' rsapublickey rsa.PublicKey (rsamodulus, rsaexponent) encrypted rsa.encrypt (password,rsapublickey) print (encrypted) AttributeError: 'str' object has no attribute 'bitlength' python python-3. ValueError: Ciphertext with incorrect length. Library/Frameworks/amework/Versions/3.7/lib/python3.7/site-packages/Crypto/Cipher/PKCS1_OAEP.py in decrypt(self, ciphertext)Ä¡66 if len(ciphertext) != k or k 167 raise ValueError("Ciphertext with incorrect length.") ValueError Traceback (most recent call last) When trying to get the ciphertext decrypted I recieve the error:. Write a program that takes the above parameters as input and implements the RSA Decryption function to recover the plaintext." And of course you need to find your way to get large prime numbers, read about prime testing. There are some more restrictions so the cipher should be secure but it will work with conditions I provided. Decryption: d mon n . Suppose you were sent the Ciphertext 6627708. Public key: (n, e) Private key: (n, d) Encryption: e mod n ."Suppose your RSA public-key factors are p = 6323 and q = 2833, and the ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |