Put my own text on kyber

When I was working with Kyber on ChipWhisperer, I used cw.capture_trace() to obtain the trace, with the key and text generated by the function cw.ktp.basic(). Now, I want to use my own text with cw.capture_trace(). When I generate the text using np.random.bytes(16), I encounter an error: “a bytes-like object is required, not ‘tuple’.” How can I fix this issue?

Additionally, does cw.capture_trace() only accept 16-byte text? I am looking to encrypt a 32-byte text.

You can look at the cw.ktp.basic() source to see what’s expected: chipwhisperer/software/chipwhisperer/capture/acq_patterns/basic.py at develop · newaetech/chipwhisperer · GitHub

Again if you look at the cw.capture_trace() source, you’ll see that it takes whatever plaintext you give it and writes it to the target:

You just need to make sure that on the target side, the function which processes the plaintext excepts a plaintext of the correct size.