Sunday, 8 September 2013

Public Key Encryption

Ask somebody if they've ever heard of, or used Public Key Encryption and I pretty much know what the answer will be. If they're being nice, it'll be "No". If not, they'll look at you and say "Go away geek!".

Those that say they've never used it or never heard of it would be shocked to hear just how much Public Key Encryption is used today and how much we rely on - what is essentially - a set of very large, special numbers. Prime Numbers - divisible only by themselves, and 1.

Public Key Encryption is used all over the Internet and in everyday life. When you visit websites sporting that little padlock to joining WiFi networks!

It's all in the numbers

Public Key Encryption uses some very clever (but basic) mathematics. In basic terms, this technology is based on the multiplication of two large prime numbers to create a new, even larger number called a semi-prime. In doing this, we are able to generate cryptographic 'keys' that are used (in their basic use) to encrypt and decrypt data.

As an example, if we take two small prime numbers (my maths is not that good) of 3 and 5. We multiple these together to create a semi-prime of 15. Easy. The larger the starting prime number, the larger the resulting semi-prime.

So what's this got to do with Public Key Encryption?  Well data is secured using cryptographic keys generated from massive prime numbers. The keys consist of a public and a private key pair.  The public key is used to encrypt the data, and the private key is used to decrypt it.

It works like this

We take two prime numbers, P1 and Pand multiply them together to create a composite number, C. Computers are amazing an multiplying two numbers together but not so good at doing the reverse, taking composite C and trying to find the two original prime numbers, P1 and P2.

NB: It's worth noting that these numbers are not as small as in the above example, they are often of the magnitude of 617+ digits long, creating a 2048-bit public key.

We now take C and generate a public key from it. This is used to encrypt the information and keep it secure while being sent over an insecure channel, such as the Internet.

P1 and P2 (which make up the private key) are then used to decrypt the data by the recipient. Should the encrypted data be intercepted en route to the recipient, the interceptor will need to reverse engineer C to discover the two original primes used to create C. This is known as factorisation, and computers are not so hot at doing this - but if you have P1 and P2, it's possible to decrypt the message (encrypted with C) in seconds!

As I mentioned earlier, my maths is not that strong so let me drop in a video here from NumberPhile:



No comments:

Post a Comment