Rate This Document
Findability
Accuracy
Completeness
Readability

Introduction

This document describes how to develop the Rivest-Shamir-Adleman (RSA) demo code in the TrustZone environment of Kunpeng servers.

RSA Encryption Algorithm

RSA is a public-key cryptography (also called asymmetric encryption) algorithm proposed in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman at the Massachusetts Institute of Technology (MIT). It is the most widely used and accepted public key algorithm, which is rock-solid, a longer key posing a higher difficulty in cracking. According to disclosed documents, the longest RSA key that was cracked had 768 bits, and no keys longer than 768 bits have ever been cracked. That means a 1024-bit RSA key is secure enough, and a 2048-bit RSA key is extremely secure.

RSA Digital Signatures

The RSA digital signature system is derived from the RSA public-key cryptographic algorithm. Since the RSA algorithm has proved itself secure (at least so far), the RSA digital signature system has been adopted in many security standards.

The RSA digital signature system consists of the signature algorithm and verification algorithm. It encrypts the message digest generated by a hash function (SHA256) rather than directly encrypting the original text. If the original text changes, the message digest also changes, and the value of the digital signature changes accordingly. That is, different messages receive different digital signatures. A valid digital signature enables the receiver to receive the correct verification information because only the sender has the correct private key. If a third party pretends to be the sender and sends a message, the receiver uses the public key of the sender to verify the digital signature. On the condition that the third party does not know the private key, the digital signature generated after encryption must be different from the recalculated digital signature. In this way, the authenticity of the digital signature is effectively ensured.