def test_ss(): cipher = AES256CFB(secrets.token_urlsafe(20)) iv, encrypt = cipher.make_encrypter() length = len(iv) // 2 parser = ss_reader.parser(cipher) parser.send(iv[:length]) assert parser.read_output_bytes() == b"" data = os.urandom(20) parser.send(iv[length:] + encrypt(data)) assert parser.read_output_bytes() == data
def test_ss2(): cipher = AES256CFB(secrets.token_urlsafe(20)) iv, encrypt = cipher.make_encrypter() parser = ss_reader.parser(cipher) parser.send(iv) assert parser.read_output_bytes() == b"" assert parser.read_output_bytes() == b"" data = os.urandom(20) parser.send(encrypt(data)) assert parser.read_output_bytes() == data