DEV Community

Cover image for Encryption: Understanding the Public Key and Private Key
Pedro Aravena for Vaultree

Posted on • Updated on

Encryption: Understanding the Public Key and Private Key

The need to send confidential messages always existed, in old times people sent their letters written in codes, where only those who sent and those who received would know how to decipher, since before exchanging messages already incorporated, passwords or keys were combined. Nowadays it has a name, of Greek origin cryptography means:

Kryptos : Hidden + Graphein : Writing = Hidden writing.

Over time, other ways of communicating secretly were developed and in this way we have public-key and private-key cryptography, but when provoking corporeal materials, the network and its mathematical functions are used. Communication between stakeholders is necessary for an information transition to occur. Let's use the an example to better understand it? In a very simple way:

Mary wants to send a file number 500 to Daniel, otherwise, she uses the padlock number 10, multiplying these values gives the value of 5000, where Mary sends this result to Daniel, however, he doesn't know the lock that Mary personal, then, Daniel chooses padlock number 20 and multiplies it by the result he chooses (20 x 5000 = 100000) and sends it to Mary who, upon receiving an answer, divides by the number of her padlock (100000/10 = 10000) and sends it one last time to Daniel who, upon receiving the result of the division, knows that he only has to divide the result by the number of his padlock (10000/20 = 500) to access the file.

Image description

In the example above, the security level is simple, that is, only hypothetical and also depending on the case, all this communication is not necessary, because when you want to transmit a file, it is enough to have the key number to be able to send it safely, because, only with a private key of that public key can decrypt the code (of the public key) and gain access to the file. Got confused? Let's make it clearer then, look at this image:

Image description

Nowadays, cryptography is nothing more than an algorithm that works as an asymmetric system where a pair of mathematically connected keys is used. One is a public key that encrypts data and the other is a corresponding private key that does the decryption work (the two keys are connected together). A private key must be kept secret and known only to its owner, whereas a public key can be distributed on the Blockchain network with security that a private key will not be discovered, that is, there is a cryptographic key pair in a Blockchain.

The generation of these keys happens computationally. So, the public key is generated from the private key. But, it is not possible to generate a private key from a public one. In order to produce a valid address on a Blockchain network, a private key is first generated and from it, various algorithms can be used to derive a public key.


At Vaultree we are building an encrypted future. We love sharing valuable information and trends to help you keep your data safe. Sign up to stay in the loop and discuss the hottest trends in cybersec with a team of experts.

Image description

Top comments (0)