Skudo Kryptor Tutorials
Read the tutorials and learn how to use the Kryptor FPGA board
These are meant for the CrowdSupply product devices.

This tutorial is specifically meant for the Skudo Kryptor PCB board sold via CrowdSupply and via Mouser.

As we have demonstrated through many of our previous tutorials, our SKUDO Kryptor board can be easily used with the Raspberry Pi board. This time we will show you how to use our SKUDO Kryptor board with an Arduino Nano (just for the sake of this demo but you can use any model).
In the previous tutorials, we learned how to connect and use this device with a Raspberry Pi board. Today, we will show how to use our SKUDO Kryptor with an Arduino Nano (just for the sake of this demo but you can use any model).

The Arduino board is a microcontroller capable of executing certain steps (read inputs - light on a sensor, a finger on a button) programmed via so-called “sketches”. This way, you can tell your board what to do by sending a set of instructions to the microcontroller on the board. In this tutorial, we will learn how to connect the Arduino Nano to our SKUDO Kryptor and how to execute some of the basic functions provided by it. We will see how to verify the SPI connection is properly set, how to read the FPGA chip unique serial number, how to generate random numbers and how to encrypt and decrypt arbitrary data, finally how to use the ECDH algorithm.

First, let’s understand how to connect together the different hardware components.

 
 Comment

All you need to do (in the same way as we showed for the RPi) is to connect the SPI port (SCK, MISO, MOSI, and SS) of your Arduino to the Kryptor PCB. The signals are also going through a level converter to adjust the 3V3/5V difference between the two types of boards (Arduino’s GPIOs operate at 5V while Kryptor’s GPIOs operate at 3V3). We’ve also settled with 250KHz SPI speed because of the slow level shifter. Finally, the following picture comes from the Oscilloscope analysis of the quality of signal we can get.

Now we can jump right into the coding, you can find all sources on our GitHub repository here. But of course, you can also try to build your own implementation and integrate it with your own system. It is pretty simple and intuitive.
First of all, we can show the basic output when checking the Kryptor version (using the option “-m”) and then perform encryption and decryption of a simple text message. On the left, you can see the code that does high-level calls to the library functions, and on the right, you can see the output produced by that part of the demo. We have included timestamps in the monitor so it will be clear how fast it goes.

In the above sketch, we can see how we generate a key (“setup_key”) by using the onboard TRNG and then store it in the “Slot 0” (a portion of the flash memory inside the FPGA chip). We print the generated key and then use it to encrypt (“encrypt_message”) a text message and then decrypt it (“decrypt_message”). And the Serial Number is obtained by the function “print_hw_attributes()” (refer to the Github repository for more details).

In the following example, we can see how the True Random Number Generator (TRNG) works and is running.

In the above sketch, we can see how to generate 16 bytes (see the variable “size”) of random numbers with a simple call to the “get_random_bytes” function.

Now let’s see how to use the Skin hashing function.

In the above sketch, we can see how to hash 3 messages together in a sequence of hashing functions and then print the final result.

Finally, in this last example, we can see how to use the ECDH algorithm.

In the above sketch, we can see how to generate the two asymmetric key-pairs (local and remote) which are then used exchanging the public keys between the two parties. Finally running the ECDH algorithm (“setup_ecdh_key”) we would obtain the secret shared key.

This completes the tutorial on how to use the SKUDO Kryptor HSM/FPGA board in connection with an Arduino board.

Do You Have a Tip or a suggestion for an interesting topic? Tell Us About It.

About Skudo

We envision a world where all digital communications are safe and private. We are dedicated to creating innovative best-in-class hardware solutions that protect data exchange with the highest level of security and privacy.