Talking about True Random Number and its Application in imKey Pro
For people who have some exposure to blockchain, most have heard of encryption terms such as "asymmetric encryption" and "hash algorithms", but not everyone knows that the cornerstone behind these encryption algorithms is "random numbers".
During the process of creating a wallet, users can "randomly" obtain a private key, which is used to calculate the address through cryptographic calculations. With the address, users can receive digital currencies, and the private key is the only means of controlling the digital assets on this address. Therefore, whoever possesses the private key, owns the assets on the corresponding address on the blockchain.
So, will the private key eventually run out? Can it be cracked by brute force attacks?
To eliminate these concerns, you need to first understand random numbers.
I. The Importance of Random Numbers
In computer science, random sequences have important roles in many fields, such as computer simulation, statistical sampling, cryptography, network gaming, etc. Different fields have different requirements for the quality of random sequences. For example, in network games, there are many random events such as critical hit rate calculations and lottery draws, and these scenarios generally use specific pseudo-random mechanisms to reduce the probability of consecutive hits or non-hits or to implement the strategy of always winning on the tenth consecutive draw. All of these are to provide better gaming experiences for players. However, in the essential field of information security, which is based on attack and defense, random numbers that do not meet the requirements of "randomness" and "unpredictability" are clearly unacceptable, as this may cause irreparable vulnerabilities in the security system.
Whether it is in the design of password protocols or more basic password algorithms, random numbers are the core dependence for combating attacks. According to Kerckhoffs's principle, the security of a password system should depend entirely on the key rather than on the secrecy of the system design. The key usually comes from a randomly generated sequence, so the quality of random numbers is very important in password systems. In ideal situations, completely random keys can only be cracked through brute force attacks.
Random numbers are widely used in applications such as key generation, digital signatures, authentication and identification, as well as various protocols related to secure communication, such as:
- In key distribution schemes, random sequences are usually used as handshake information to prevent replay attacks.
- In the SSL/TLS protocol process, random sequences are not only used to prevent replay attacks but are also the basic elements for generating session keys.
- The key generation and signing process of asymmetric key algorithms uses publicly available mathematical algorithms and random sequences to provide engineering implementations for security.
II. Random Number Generators
Generally speaking, random numbers have the following three verification standards:
1. Randomness - random sequences should have good statistical properties, with no statistical bias, and are completely chaotic sequences. The distribution of random numbers in the sequence should be uniform, with the frequency of appearance being roughly equal. Numbers that meet these requirements are "random" at a glance to humans.
2. Unpredictability - given a part of the random sequence and the random algorithm, it should not be possible to effectively calculate other parts of the random sample.
3. Unrepeatability - unless the random sequence itself is saved, it is impossible to have the same sequence.
Usually, random number generators that meet conditions 1 and 2 are called pseudo-random number generators (PRNGs), while generators that meet all three conditions are called true random number generators.
Pseudo-random number generators (PRNGs)
in computers use a deterministic algorithm to produce random numbers when given a specific initial condition. The generated random numbers will always follow a certain pattern within a cycle, meaning they will repeat after reaching the cycle, even if they satisfy specific distribution requirements for randomness statistics. This is because their results are visible and predictable in a specific cycle. Therefore, the random numbers generated by this method are not "random", and we call them pseudo-random numbers, and the corresponding method is a pseudo-random number generator. In engineering implementations, it is usually necessary to set the cycle long enough (much longer than the length of the possible collected random numbers), but it is indeed regular and predictable in theory.
True random number generators (TRNGs)
Have strict conditions for true randomness. Under given boundary conditions, random numbers generated under classical mechanics can be considered as pseudo-random numbers because physical noise, temperature changes, etc. are observable. However, for practical application needs, if the boundary conditions are complex and difficult to capture, they can be considered as true random numbers.
So, how do computers generate true random numbers?
It usually requires introducing external entropy sources to greatly reduce the periodicity of the generated random sequence. The random number generator of the UNIX kernel (/Dev/Random) and RtlGenRandom in the Windows kernel are both implemented in this way. UNIX maintains an entropy pool and continuously collects non-deterministic device events as seeds to generate random numbers, while Windows collects process, thread, time, CPU internal high-precision counter, and other information as internal entropy sources.
True random numbers can be described as a TRNG based on an unpredictable physical phenomenon (called an entropy source) for generating non-deterministic data (such as a continuous string of numbers), with the goal of providing seeds for cryptographic algorithms.
After generating a large number of true random numbers and pseudo-random numbers and visualizing them, as shown in the figure below, we can intuitively see that true random numbers have no regularity, while pseudo-random numbers are arranged according to a certain pattern.
III. True Random Number Generators (TRNGs) in Security Chips
The TRNG in security chips typically consists of an entropy source and an extraction or sampling unit. The sampled data then needs to be processed by a post-processing unit or a password adjustment unit for quality control. The quality of the generated random numbers highly depends on the original entropy output from the entropy source. Usually, a single or multi-channel random source circuit based on physical noise is built-in. Each random source circuit samples independently, and after the analog signal is extracted into a usable digital form, it is processed by the post-processing unit to eliminate the bias in the original output or to enhance the signal, etc. Random numbers obtained in this way are mainly used in cryptography, and a TRNG with high quality is also an essential feature of security chips.
To ensure the reliability of the random number generator, the security chip will perform a self-test on the TRNG every time it is powered on, and usually supports on-demand testing.
(Note: Typical architecture of noise-based TRNG)
IV. TRNG Testing
There are some certification agencies and certification specifications both domestically and internationally to verify whether the generation of TRNG meets the three standards of true randomness: randomness, unpredictability, and irreproducibility.
For example, NIST's SP 800-90 A/B/C standard provides corresponding testing suites, and section 4.9.2 of FIPS 140-2 stipulates "Continuous Random Number Generator Testing," etc., and the testing standard is SP 800-90B standard, as shown in the figure below.
V. How to Use the TRNG Functionality in imKey Pro
The core of the imKey Pro product is Infineon's SLE78CLUFX5000PH, which provides comprehensive error detection, self-test dual CPU, and full encryption data for digital security solutions "integrity protection," including CPU internal encryption calculation.
(Note: RZH1532 represents the production batch number of the SLE78CLUFX5000PH chip)
The chip meets the general standard EAL6+ (Advanced) and EMVCo certification.
The corresponding certificate can be found on the CC official website:
The Public Security Target document specifies that the random number module of the chip has passed the SP 800-90B standard, which can be found in detail at:
Having a high-quality TRNG also requires correct use in engineering practice. imKey Pro uses TRNG throughout the entire product life cycle, including but not limited to:
- Generation of device unique certificate key pairs
- Generation of connection authorization codes
- Generation of entropy when creating a wallet
- Generation of encrypted storage keys
- Random numbers used in the signature process, such as K-values in 256K1 signature (RFC 6979 can also be used optionally)
- Establishment of SCP11C secure channel for device management
Source: Feitian Chengxin Product R&D Department