import unittest
import base64
from py3rijndael import Rijndael
def test_rijndael():
key = 'qBS8uRhEIBsr8jr8vuY9uUpGFefYRL2HSTtrKhaI1tk='
print(len(key))
a=input("Please Enter Plain text: ")
plain_text=a.encode('utf-8')
rijndael = Rijndael(base64.b64decode(key), block_size=32)
padded_text = plain_text.ljust(32, b'x1b')
cipher = rijndael.encrypt(padded_text)
cipher_text = base64.b64encode(cipher)
pl_txt=rijndael.decrypt(cipher)
pl_txt[:len(plain_text)]
return cipher_text
In the above code, I want to generate a random key for the secure private key
changing any character in the key for ex: making
key = 'qBS8uRhEIBsr8jr8vuY9uUpGFefYRL2HSTtrKhaI1tk+' or some thing else, making test to fail with invalid key size. could someone please help with this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…