Ecies encrypted string length can be different in rare cases
This commit is contained in:
parent
e24d1016a5
commit
5c1ec0b141
1 changed files with 2 additions and 2 deletions
|
@ -11,12 +11,12 @@ class TestCrypt:
|
|||
ecies_encrypted_text = "R5J1RFIDOzE5bnWopvccmALKACCk/CRcd/KSE9OgExJKASyMbZ57JVSUenL2TpABMmcT+wAgr2UrOqClxpOWvIUwvwwupXnMbRTzthhIJJrTRW3sCJVaYlGEMn9DAcvbflgEkQX/MVVdLV3tWKySs1Vk8sJC/y+4pGYCrZz7vwDNEEERaqU="
|
||||
|
||||
@pytest.mark.parametrize("text", [b"hello", '\xc1rv\xedzt\xfbr\xf5t\xfck\xf6rf\xfar\xf3g\xe9'.encode("utf8")])
|
||||
@pytest.mark.parametrize("text_repeat", [1,10,1024])
|
||||
@pytest.mark.parametrize("text_repeat", [1, 10, 128, 1024])
|
||||
def testEncryptEcies(self, text, text_repeat):
|
||||
text = text * text_repeat
|
||||
aes_key, encrypted = CryptMessage.eciesEncrypt(text, self.publickey)
|
||||
assert len(aes_key) == 32
|
||||
assert len(encrypted) == 134 + int(len(text) / 16) * 16
|
||||
# assert len(encrypted) == 134 + int(len(text) / 16) * 16 # Not always true
|
||||
|
||||
ecc = CryptMessage.getEcc(self.privatekey)
|
||||
assert ecc.decrypt(encrypted) == text
|
||||
|
|
Loading…
Reference in a new issue