30 February 2023, 12:00 CET “The news spread like wildfire. Threads multiply on Twitter to present the evidence on chain night events. Crypto experts are unanimous and do not submit any doubts. Satoshi’s wallet Nakamoto is empty.
Even more alarming, it’s not the alone. More movements have just been detected on Satoshi-era wallets. In particular a certain portfolio belonging to the fire cypherpunk Hal Finneyknown to have received the first bitcoin transaction in history. Panic takes hold of the market, Bitcoin volatility explodes and trades mark $14,000. Internet users are starting to imagine the worst. If the wallet of our delay Hal Finney it was also emptied, there can only be two explanations. O Nakamoto had it access to his private key. Or are we witnessing an event of unprecedented scale, not just announcing the death of bitcoin.
In my previous message, I introduced you to the principle of electronic signature and the basic conditions it must meet to allow yours authentication even on the blockchain Diffie-Hellman key exchange laying the foundations of asymmetric encryption. Today we will delve into the first cryptographic protocol that allows for strong electronic signatures, RSA encryption.
But first, remember, I gave you a little respite modular mathematics. “This Time, You Won’t Escape” – I let go of a Machiavellian voice behind my keyboard. But don’t worry, it’s quite easy to understand, you do it every day without knowing it!
Modular watchmaking and mathematics
Forget everything you know, from now on, 12 = 0
So last week I told you about the modular math that was used, in the Diffie-Hellman key exchange, to simplify the calculations that our two interlocutors have to make Alice and Bob. However, his involvement in RSA encryption is much more important, because it directly intervenes in encryption and decryption messages between our two interlocutors, which is why I will try to explain it to you.
What if we find out 12 ≡ 0 ?
(I use the triple equals sign here for mathematical rigor. Yes, it’s not the symbol ofEthereum although it is very close, understand here simply 12 = 0. The triple equal sign will be used as soon as we talk about equality in a modular system).
Spoiler, this would upset the way we calculate, but you already experience this every day!
For the mathematicians among you, this should remind you of the trigonometric circle. On this circle 2π equals 0, similarly for 4π, 6π, etc. It’s the same for our watches, 5pm is also equal to 5:00. Modular math boils down to wrapping the line of all numbers around a circle in a predefined loop. 12 in the example of our watches. They say we are a mathematics module 12.
What are the benefits for encryption?
” Ok Lightnings, that’s very good, but what application in cryptography? I still don’t see the connection » you will tell me.
Patience, I’m coming! In Diffie-Hellman key exchange, we were doing some calculations with of the powers of gigantic numberthis is what happens when we apply a module 12 math.
See what that will entail? Math module 12 allows us to simplify 5^2 times 1. From this calculation, we can simplify any power of 5:
- For every even power: 5^(even number) will equal 1,
- For any odd power: 5^(odd number) will equal 5.
It is this little mathematical sleight of hand that makes it possible to use power functions with cryptographically large numbers. Small test to check if you understand the logic:
In math module 12, what is the result of 5^974896232?
We will write the result like this: 5^974896232 ≡ 1 (mod 12) — with mod per module.
Easy right? (yes, I’m definitely trying to convince myself that my explanations were clear.) Now that modular math is no longer a barbaric word for you, we can move on to RSA encryption. Hang in there, because this is going to be the hardest part of my cryptocurrency series!
>> Prefer to keep your cryptocurrencies safe? Choose a Ledger Wallet (trade link) <
Construction of public and private keys
RSA encryption, named after the initials of its three inventors, Ronald Rivest, Adi Shamir And Leonard Adelmann, uses asymmetric cryptography based on the work of Diffie-Hellman. Where the Diffie-Hellman key exchange only allows for the creation of an encryption key without prior clear agreementthe RSA protocol goes further by allowing directly exchange of information using public key cryptography. The RSA protocol introduces trap door functions.
They have the same properties as one-way functions explained in my previous postother than that they have what is called a “back door », numbers permitting the reversibility of the encryption function.
Alice and Bob, still them, want to exchange and sign a document and have never interacted in the past. Alice will create a key pair, a private key which will be used by Alice to sign Bob’s document, e a public keywhich will be used to verify that the signature really comes from Alice.
(First, don’t worry too much about the math details in red if you’re having trouble understanding them. Just remember the logic.)
Alice therefore has three numbers in her possession. The public number NOTits public key d and its private key And. These are all calculated using numbers p And q that she must absolutely destroy in order not to compromise his private key!
This is where the modular math explained above will work its magic:
- Bob wants to sign a document m in Alice.
- Alice perform the calculation: C = M^e mod N and send the result VERSUSrepresenting his signature, and number NOT in Bob.
- Bob perform the calculation: C^d (mod N) this is M^e^d (mod N). If thanks to this calculation Bob finds the document m how did he send it to Alice. And this’Alice signed with his private key.
Thanks to our modular mathematics, we therefore have in summary, encryption with Alice’s private key and decryption with her public key :
(Document) ^ (Alice’s private key) ^ (Alice’s public key) = Document
If you recall the “power functions” property presented last time, the opposite is totally possible. But it’s not equivalentbecause nothing will allow it Alice to make sure it is Bob who sent him the encrypted document, since it is encrypted with his public key. Self Bob wants to keep the document secret, he will have to encrypt it first with your private key.
During an electronic signature, encryption with a private key and decryption with a public key will always be preferable.
Strength and properties of RSA encryption
The robustness of this encryption comes from the impossibility for a third party to find it Alice’s private key only through public numbers NOT, VERSUS And d in a reasonable time. This comes from the complexity and unreasonably long computation time needed to achieve prime factorization public number NOT to find p And q. A number that would make it easy to find Alice’s private key by brute force.
Today we know how to find this “brute force” decomposition with numbers of 795bits. But commonly used RSA keys are 2048 bits, which still leaves us some leeway. However, some doubts linger due to a quantum algorithm being able to break RSA relatively easily, Shor’s algorithm.
To go back to the electronic signature, here, Bob challenges Alice sign the document m with his private key, if he can’t find the document m identically via verification using Alice’s public key. It’s not Alice who signed the document! The signature therefore satisfies all the criteria mentioned in the previous article, namely:
Authenticity : Alice is authenticated by her private key, which only she owns.
Tamper proof : Alice’s private key is mathematically tamper-proof, because it is protected by the inability to perform a prime factorization.
Not reusable : Signature VERSUS it is unique because it derives from Alice’s document and private key.
Inalterability : Signature VERSUS it serves as evidence as it derives from the document itself. If the document is modified, Alice will only have to sign it again and prove that her signature is different from the previous one.
Irrevocability : Respect the above rules, Alice cannot deny her signature.
No more convoluted formulas for today, I feel your eyes getting heavy after all those math pirouettes. Next time we’ll go digging bitcoins and the big boss of cryptographic protocols, the ECDSA protocolthen we’ll finish up the hashish and its role in proof of work !
30 February 2023, 4.00 pm CET With sweaty palms, sweat on their foreheads, cryptocurrency experts are doing their best to try and clear up the situation. They go through all the mathematical concepts and encryption protocols looking for a flaw, a detail, that would have gone unnoticed for more than fifty years. While the answer must be hidden there, before their eyes, the misunderstanding pushes more and more the accusations to be made against Google and China, overwhelmed by having used their quantum computer to send Bitcoins beyond the grave. The noose is tightening, but this enigma remains, for the moment, still unfathomable. Its resolution is unfortunately not yet within the reach of our understanding.
In cryptocurrency, do not save on prudence! So, to keep your crypto assets safe, your best bet is still a personal hardware wallet. To the ledger, there is something for all profiles and all cryptocurrencies. Don’t wait to secure your capital (trade link)!