Changes

Tutorial B8 Profiling Attacks (Manual Template Attack)

1,574 bytes added, 19:36, 25 May 2016
Creating the Template: Started section
= Creating the Template =
Steps This section describes how to make generate a template from the random-key traces. Our template Mention will attempt to recognize the Hamming weight assumptionof the AES substitution box output. This choice of attack point limits our template - we will not be able to find the secret key in one attack trace - but it allows us to use a smaller amount of preprocessing. A more robust template attack (for instance, creating a template for each of the 256 possible key bytes) would require at least 10 times more data.
== Loading the Traces ==
The traces recorded from the ChipWhisperer Capture program are saved as NumPy arrays. These files can be loaded using the <code>np.load()</code> function. We're interested in the traces, plaintext, and random keys used in our template captures, so we can load this data with the code:
 
<pre>
import numpy as np
tempTraces = np.load(r'C:\chipwhisperer\software\temp_attack\rand_key_data\traces\2016.05.24-12.53.15_traces.npy')
tempPText = np.load(r'C:\chipwhisperer\software\temp_attack\rand_key_data\traces\2016.05.24-12.53.15_textin.npy')
tempKey = np.load(r'C:\chipwhisperer\software\temp_attack\rand_key_data\traces\2016.05.24-12.53.15_keylist.npy')
</pre>
 
''(Of course, fill in your own filenames.)''
 
We can check this data to make sure it looks okay. Some useful checks might be:
 
<pre>
import matplotlib.pyplot as plt
print tempPText
print len(tempPText)
plt.plot(tempTraces[0])
plt.show()
</pre>
 
Get in the habit of checking your data with some basic print statements or plots - it's a good sanity check to make sure that your arrays are the size they should be! If everything looks okay, comment out these checks and move on.
 
== Sorting the Traces ==
== Points of Interest ==
Approved_users
510
edits