tgalal/python-axolotl

SessionBuilderTest class test bug - bytearray index out of range

hamzahkhan opened this issue · 1 comments

I've just started building the SessionBuilderTest class and the first 4 methods run fine. the 5th one i.e. runInteraction is giving an error. I broke the function away from the class into a separate file for ease. The code is as below -

from axolotl.invalidkeyexception import InvalidKeyException
from axolotl.sessionbuilder import SessionBuilder
from axolotl.sessioncipher import SessionCipher
from axolotl.ecc.curve import Curve
from axolotl.protocol.ciphertextmessage import CiphertextMessage
from axolotl.protocol.whispermessage import WhisperMessage
from axolotl.protocol.prekeywhispermessage import PreKeyWhisperMessage
from axolotl.state.prekeybundle import PreKeyBundle
from axolotl.tests.inmemoryaxolotlstore import InMemoryAxolotlStore
from axolotl.state.prekeyrecord import PreKeyRecord
from axolotl.state.signedprekeyrecord import SignedPreKeyRecord
from axolotl.tests.inmemoryidentitykeystore import InMemoryIdentityKeyStore
from axolotl.protocol.keyexchangemessage import KeyExchangeMessage
from axolotl.untrustedidentityexception import UntrustedIdentityException

ALICE_RECIPIENT_ID = 5
BOB_RECIPIENT_ID = 2

aliceStore = InMemoryAxolotlStore()
bobStore = InMemoryAxolotlStore()

aliceSessionCipher = SessionCipher(aliceStore, aliceStore, aliceStore, aliceStore, BOB_RECIPIENT_ID, 1)
bobSessionCipher = SessionCipher(bobStore, bobStore, bobStore, bobStore, ALICE_RECIPIENT_ID, 1)
originalMessage = b"smert ze smert"
aliceMessage = aliceSessionCipher.encrypt(originalMessage)

Error from the last line is -

Traceback (most recent call last):
  File "runinteraction.py", line 30, in <module>
    aliceMessage = aliceSessionCipher.encrypt(originalMessage)
  File "build/bdist.linux-x86_64/egg/axolotl/sessioncipher.py", line 39, in encrypt
  File "build/bdist.linux-x86_64/egg/axolotl/state/sessionstate.py", line 66, in getSenderRatchetKey
  File "build/bdist.linux-x86_64/egg/axolotl/ecc/curve.py", line 34, in decodePoint
IndexError: bytearray index out of range

Can someone help me with what's going on?

Did you find the solution to this issue?