RSA Key Generation in DS5250
Abstract: The DS5250 microcontroller evaluation (EV) kit is a proven platform to evaluate the capabilities of this high-speed secure microcontroller. This application note demonstrates how to set up the EV kit and generate the RSA key-pair of the bit length needed for an application. The Keil µVision2® compiler is used to develop the library and sample application. The Microcontroller Tool Kit (MTK2) is used to load the application on the EV kit and to observe the results.
This application note demonstrates how to generate RSA
key-pair sets using the sample application binary (rsa.hex) associated with this application note. The application note describes how to load and run the software on the DS5250 Evaluation Kit (EV kit)
The EV kit and the software related to this application note are available to customers with a valid NDA for the this device. Customers without an NDA for the DS5250
can initiate the process through the DS5250 quick view Customers with an existing NDA can contact Technical Support
to obtain the software referenced in this application note.
Getting Started with RSA Key-Pair Generation
Build and execute the RSA key-pair sample application program written in C using the Keil µVision2 IDE.
- Install the Keil µVision2 IDE.
- Open the project rsa.uv2.
- Click on ProjectRebuild All Target FILES to generate the rsa.hex file.
Loading the Sample Application onto the DS5250-KIT EV Kit
Install the Microcontroller Tool Kit (MTK2_INSTALL)
to load the application onto the EV kit. When MTK2 is launched, a dialog box similar to the one shown in Figure 1
Figure 1. MTK2 options on startup.
Select the option DS5250
to communicate to the EV kit. From the MTK2 menu, OptionsConfigure Serial Port,
select the COM port that you are using and choose 115200 speed. Next select the TargetOpen COMx port at 115200 baud
option, and then TargetConnect to Loader
to reset the EV kit. The DS5250 loader should print a message something like the following:
DS5250 SECURE LOADER VERSION 1.0 COPYRIGHT (C) 2002 DALLAS SEMICONDUCTOR
LID: 62E9490700000071 8284
Configure the EV kit memory by sending the following commands to the loader.
W MSIZE 12¹
W MCON 81²
1W MSIZE 12 identifies the external program and data memory chip size as 512kb.
2W MCON 81 identifies the memory as Partition Mode.
From the File menu, select Load HEX File and then the rsa.hex file that you just created.
Choose TargetDisconnect from Loader
to execute the program loaded onto the EV kit. The prompt appears as seen in Figure 2
Enter key length bits to be generated:
Enter the number (for example, 1024) and wait for the application to display the results. The application displays the execution status as shown in Figure 2. It takes approximately 60 seconds to generate a 1024 bit-length RSA key-pair, encrypt, and decrypt the random message. This time can vary for each execution. The minimum, maximum, and average times needed to generate an RSA key-pair for various bit lengths are tabulated in Table 1.
Figure 2. Execution status and results of sample application.
Developing a Simple Application Using RSA Key-Generation Library
The library provides four easy-to-use interface functions in C to generate the key-pair and encrypt/decrypt the user message using the private/public key. Refer to the rsalib.h file to see the prototypes of these interfaces. The application provided with this application note demonstrates the use of these interface functions:
Typical test results for different bit lengths are shown below.
|Table 1. Average Time Needed for Generating an RSA Key-Pair
|RSA Bit Length Generated
||Number of Tests Run
||Minimum Time Taken for the Test
|Maximum Time Taken for the Test
|Average Time Taken per Test
The RSA key generation library provided by Maxim allows applications written in C to access the power and functionality of the DS5250 microcontroller hardware. RSA key-pairs can be generated up to a maximum of 4096 bits.
||High-Speed Secure Microcontroller
||High-Speed Secure Microcontroller
APP 4004: Mar 19, 2007
APPLICATION NOTE 4004,