— A Brief Discussion on True Random Numbers and Their Application in imKey Pro
Introduction
For those who have had some exposure to blockchain, most have heard cryptographic terms such as “asymmetric encryption” and “hash algorithm,” but not everyone knows the cornerstone behind these cryptographic algorithms — “random numbers.”
During the process of creating a wallet, a user can “randomly” obtain a private key. By using cryptography, an address is computed from the private key. With the address, one can receive digital currency, and the private key can, and uniquely does, control the digital assets at this address. Therefore, whoever holds the private key owns the on-chain assets at the corresponding address.
So, will private keys one day be exhausted? Is it possible to brute-force them by database collision?
To dispel these concerns, you first need to understand random numbers.
I. The Importance of Random Numbers
In computer science, random sequences play important roles in many fields, such as computer simulation, statistical sampling, cryptography, and online games. Different fields have different requirements for the quality of random sequences. For example, there are a large number of random events in online games—critical-hit rate calculations and lotteries, etc. These scenarios generally use specific pseudo-random mechanisms to reduce the probability of consecutive critical hits or no critical hits, or strategies like a guaranteed hit in ten draws, all to provide a better gaming experience. But in the field of information security, which is essentially about offense and defense, random numbers that do not satisfy “randomness” and “unpredictability” are obviously unusable, as this may cause irreparable vulnerabilities in the security system.
Whether in the design of cryptographic protocols or in more fundamental cryptographic algorithms, random numbers are the core dependence in resisting attacks. According to Kerckhoffs’s principle, the security of a cryptosystem should rely entirely on the key rather than on secrecy of the system design. Keys are usually generated from random sequences; therefore, the quality of random numbers is extremely important in a cryptosystem. Ideally, a completely random key should only be crackable via brute-force attack.
Random numbers are widely used in applications such as key generation, digital signatures, authentication and identification, as well as in various protocols related to secure communications, for example:
- 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 fundamental elements for generating session keys.
- In the key generation and signature process of asymmetric algorithms, public mathematical algorithms + random sequences provide engineering-level security.
II. Random Number Generators
Generally speaking, random numbers have the following three testing criteria:
Randomness
A random sequence should have good statistical properties, exhibit no statistical bias, and be a completely scrambled series of numbers. The distribution of random numbers in the sequence should be uniform, and the frequencies of occurrence approximately equal. Numbers that satisfy this requirement appear “random at a glance” to humans.
Unpredictability
Given a portion of a random sequence and the random algorithm, it should not be possible to effectively compute the other parts of the random sample.
Non-repeatability
Unless the random sequence itself is saved, it should be impossible to produce the same sequence again.
In general, we say that a random number generator satisfying 1 and 2 is a pseudo-random number generator, and one that satisfies all three conditions is a true random number generator.
Pseudo-Random Number Generator (PRNG)
In computers, if the initial conditions are fixed and a deterministic algorithm is used to produce random numbers, then the produced random numbers will always follow some pattern within a period. This means that after reaching the period they will repeat. Even if they satisfy certain distribution requirements as defined by statistical randomness, because the results are visible and predictable within a specific period, the random numbers generated by this method are not truly “random”; we call them pseudo-random numbers, and the corresponding method is a pseudo-random number generator. In engineering practice, the period usually needs to be set sufficiently long (far greater than the length of random numbers that might be collected), but in theory it is indeed regular and predictable.
True Random Number Generator (TRNG)
The conditions for true randomness are stringent. Under given boundary conditions, it can be considered that random numbers generated under classical mechanics are all pseudo-random, because physical noise, temperature changes, etc. are observable. However, for practical applications, if boundary conditions are complex and difficult to capture, they can be regarded as true random.
So how does a computer generate true random numbers?
It usually needs to introduce external entropy sources so that the periodicity of the generated random sequence is greatly weakened. The UNIX kernel’s random number generator (/Dev/Random) and the Windows kernel’s RtlGenRandom are such implementations. UNIX maintains an entropy pool, continuously collecting non-deterministic device events as seeds to generate random numbers; Windows collects information such as processes, threads, time, and internal high-precision CPU counters as internal entropy sources.
True random numbers can be described in this way: TRNG is a function or device based on an unpredictable physical phenomenon (called an entropy source) used to generate non-deterministic data (for example, a sequence of consecutive numbers), with the goal of providing seeds (Seed) for cryptographic algorithms.
After generating large amounts of true random numbers and pseudo-random numbers and visualizing them, as shown in the figure below, one can intuitively see that true random numbers have no pattern at all, whereas pseudo-random numbers are arranged according to certain regularities.
True random numbers pseudo-random numbers
III. True Random Number Generators in Secure Chips
Typically, the true random number generator in a secure chip consists of an entropy source and an entropy extraction or sampling unit. The sampled data must also undergo quality control through a post-processing unit or cryptographic conditioning unit. The quality of the generated random numbers depends heavily on the original entropy output by the entropy source. Usually, one or more random-source circuits based on physical noise are built in. Each random-source circuit samples independently. After extracting the analog signals into usable digital form, they are handed over to the post-processing unit for processing, such as eliminating bias in the original output or enhancing the signal, etc. Random numbers obtained in this way are mainly used in cryptographic technology, and having a high-quality TRNG is also an indispensable functional point of a secure chip.
To ensure the reliability of the random number generator, the secure chip performs a self-test on the random number generator each time it powers on, and usually also supports initiating tests at any time.
(Note: A typical architecture of a noise-based TRNG)
IV. TRNG Testing
Domestically and internationally, there are certification bodies and specifications to verify whether the output of a TRNG meets the three standards of true random numbers: randomness, unpredictability, and non-repeatability.
For example, NIST’s SP 800-90 A/B/C standards provide corresponding test suites; section 4.9.2 of (FIPS) 140-2 stipulates “continuous random number generator tests,” etc., and the testing standard is the SP 800-90B standard, as shown in the figure below.
V. How imKey Pro Uses True Random Number Functionality
The core of the imKey Pro product is Infineon’s SLE78CLUFX5000PH, which provides comprehensive error detection, dual-CPU self-tests, and fully encrypted data for “integrity protection” in digital security solutions, including cryptographic computation inside the CPU.
(Note: RZH1532 represents the production batch number of the SLE78CLUFX5000PH chip)
This chip meets the Common Criteria EAL6+ (high) and EMVCo certifications.
The corresponding certificate can be viewed on the CC official website:
https://www.commoncriteriaportal.org/files/epfiles/0879V4c_pdf.pdf
The Public Security Target document indicates that the random number module of this chip has passed the SP 800-90B standard; for details, see:
https://www.commoncriteriaportal.org/files/epfiles/0879V4b_pdf.pdf
Having a high-quality true random number generator still requires using it correctly in engineering practice. imKey Pro uses TRNG throughout the entire product lifecycle, including but not limited to the following aspects:
- Generation of the device’s unique certificate key pair
- Generation of connection authorization codes
- Entropy generated when creating a wallet
- Generation of ciphertext storage keys
- Random numbers used during the signing process, such as the K value in 256K1 signatures (RFC 6979 can also be selected)
- Establishment of the SCP11C secure channel for device management
Source: Feitian Technologies Product R&D Department
If you would like to learn about the imKey hardware wallet, you can contact us:
Official email: support@imkey.im
Important Notice:imKey sells physical security hardware products only and does not provide any virtual asset trading, custody, or funds-related services. References to third-party wallets, exchanges, or decentralized applications are for compatibility purposes only; related functions and services are provided independently by third parties.
0 comments
Article is closed for comments.