# A Blockchain based PKI Validation System based on Rare Events Management
## 4 A New Approach to X.509 Certificate Management Using Distributed Ledger Technology (DLT)
### The Smart Contract Structure and Its Relationships with the Consensus Algorithm
## 6 Conclusions

In this paper has been proposed a blockchain solution to avoid some weaknesses introduced by the usage of PKIs. We started by analyzing these weaknesses. Their origin comes from the usage of a

Figure 2: Considering the structure of an IP address, we defined an index of sparsity based on a random sample of IP addresses. This absolute index was relativized using a cost function exponential in the sample size. Repeated experiments showed that 30 is a good number for the size of a sample. hierarchical architecture (the PKI) in a non-hierarchical context, where there are many CAs with no hierarchical constraints between them and the certified subjects. Furthermore, software architecture is open, allowing clients to connect the CAs from their computer. This is also not coherent with a hierarchical context. The analysis suggested that the solution had to be found in a distributed context, outside of the PKIs. This context is a blockchain where the peers are all actors involved in the PKI. The first weakness we analyzed was that the PKIs are exposed to risks due to potential failures of CAs that may be used to issue unauthorized certificates for end-users. We defined a solution where an unauthorized certificate, issued by a CA, fails to work. In fact, if a previous authorized certificate for the same server is issued and declared in the blockchain by a CA or by a server, then each event regarding the new fake certificated does not obtain consensus in the blockchain. A server that wants to be preserved from this type of attack is motivated to enter the blockchain as a server peer. There is one aspect to underline. The proposed solution allows an error to be distinguished from an attack. In the first case, the CA issuer of the unauthorized certificate will declare its existence and the issued certificate. Additionally, the involved server can declare the certificate. Then, the error emerges. If these events do not happen, then there will be an attack. Analyzing past attacks to CAs, we note that more than the breach, the fragility of the countermove that involves clients, and then protects only updated browsers, has to be underlined. This is another weakness in PKIs that our blockchain approach resolves. A fake CA or a fake certificate can be discovered also by a non-updated browser. Another class of fragilities relates to the efficient management of CRLs. In the proposed blockchain, a server can directly insert an event of certificate revocation for his certificate in the blockchain. All clients will immediately reject the revoked certificate (if proposed). The expired or revoked certificate is also rejected if the server is not a peer of the blockchain. If a fake server learns the private key associated with the expired certificate (for example, with a brute force attack) and tries to use it, when a client receives this fake certificate during a TLS transaction, a random sample of peers (consensus subset) will execute the Validate smart contract. For peers under attack by the fake server, the Validate procedure will return VALID, even if the certificate is a revoked certificate. However, the consensus algorithm will reject the revoked certificate because the majority of peers will connect with the correct server and will receive the updated certificate (see Figure 1). Man in the middle attacks fail because there cannot be two certificates associated with the same subject. The set of clients that executes the smart contract is randomly selected. In this set, only a limited number of clients will be involved in the man in the middle attack. All the other clients checking the server certificate will receive the correct certificate, and then the Validate procedure will return the status FAKE. For the consensus algorithm (Figure 1, Steps 4 and 5), the tuple will be inserted into the blockchain with the value FAKE.