Your Title - math2022-09-28T21:26:51-03:00http://example.com/tag/math.htmlAuthor HerePKI - Public and Private key pairs2012-06-04T00:00:00-03:00http://example.com/entries/pki-public-and-private-key-pairs<p><strong>PKI</strong> or, <em>public-key infrastructure,</em> is a mathematical way of securing communication between two ends.</p>
<p>The reliability of this method rests on some properties of <strong>prime numbers</strong>.</p>
<p><strong>Prime numbers</strong> are just integer numbers that have no smaller number that divides them, producing another integer, <strong>e.g.:</strong> 13 or 7 or 23. </p>
<p>It just so happens that nobody has yet created an <strong>effective factorization (or factoring) algorithm</strong> that, given a large number <strong>a</strong>, quickly outputs the list of numbers that divide <strong>a</strong>. For example, such algorithm would, if given <strong>24</strong> as input, output the list of numbers that divide 24: <strong>1, 2, 3, 4, 6, 8, 12, 24</strong>. There are, of course, some algorithms to do this but most of them <strong>aren't very fast</strong> and take waaay too much time (decades) to factorize a number with, for example, 200 digits.</p>
<p>So some computer scientists have noticed that this could be used to encrypt data being sent over a network.</p>
<p>That's where the concepts of <strong>public key</strong> and <strong>private key</strong> come into play.</p>
<p>Since large number are very hard to factorize, you could choose two very large (100 digits or more) <strong>prime numbers</strong> and multiply them together, yielding a (roughly) 200-digit number. </p>
<div style="text-align:center; margin-bottom: 7px; margin-top: 7px; min-height: 257px !important; height: 257px !important;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ab_test_medium_square -->
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-2217532725941275"
data-ad-slot="3340325586"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<p>Generating large primes and performing multiplication, albeit with large numbers, is <strong>relatively straightforward</strong>.</p>
<p>Having the two (large) prime numbers and the (even larger) product of both, you could now create an <strong>encrypting mechanism</strong> whereby the product would be a <strong>lock</strong> and the two prime numbers a <strong>key</strong>. </p>
<p>As is the case with real-life locks and keys, your house isn't rendered less secure because your front door <strong>lock</strong> is exposed to everyone. Only by having a <strong>key</strong> can you enter your house.</p>
<p>That's <strong>exactly</strong> what happens when you use a <strong>PKI</strong> to secure communication between two parties. The difference is that the <strong>lock</strong> is called <strong>public key</strong> and the <strong>key</strong> you would use to open your home's door <strong>private key</strong>.</p>
<p>The <strong>public key</strong> (product of the two primes) can be used to verify that you have the correct primes that, when multiplied, yield that product. However, due to practical difficulties mentioned earlier in factorizing a large number, the <strong>public key</strong> can't be used to derive the <strong>private key</strong>, rendering the method safe.</p>
<div style="text-align:center; margin-bottom: 7px; margin-top: 7px; min-height: 257px !important; height: 257px !important;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ab_test_medium_square -->
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-2217532725941275"
data-ad-slot="3340325586"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<p><strong>N.B.:</strong> this is an oversimplified explanation of a PKI. Although qualitatively correct, there are many technical details that were left out.</p>