Categories
3. Modern Cryptography

Public key infrastructure

Another important caveat to asymmetric cryptography is that it typically requires a trusted, centralized authority. This is because the problem of verifying that someone is who they say they are isn’t limited to just proving that someone holds a private key (something asymmetric encryption can do on its own). Instead, to ensure that (for example) a web server’s SSL/TLS certificate is not only technically valid, but also authentic (truly represents the organization it claims to), a central authority (Google, for example) must be referred to.

This creates more opportunities for hackers, as any breach within the hierarchy of validating keys compromises all the keys below. Although such breaches do happen, much of the internet relies on this system. The system as a whole is known as public key infrastructure (PKI). A trusted party that issues certificates is a certification authority (CA).

An alternative to PKI is pretty good privacy (PGP), wherein users trust each other on a peer-to-peer, distributed basis, instead of relying on a centralized authority (here too asymmetric keys are used to exchange symmetric keys). PGP is commonly used to encrypt email and to verify that downloads have not been tampered with.

The most sophisticated use of asymmetric keys and cryptography in general is found in blockchain systems, exemplified by Bitcoin. By eliminating the need for a centralized authority and moving the validation of cryptographically signed transactions to the network, a blockchain opens up the possibilities for new kinds of systems built on a distributed-yet-secure layer atop the internet infrastructure. We are just now witnessing the teasing out of these possibilities.

Blockchains and the systems built on them are essential cryptographic structures. Key pairs are used to sign transactions, and crypto hashes are used to validate the links in the chain.

This has been a whirlwind tour of the current crypto landscape. Although there is much complexity involved, understanding the lay of the land is increasingly valuable to all of us, programmers and non-programmers alike.

Categories
3. Modern Cryptography

Asymmetric keys

Perhaps the most ingenious and influential development in modern cryptography is the asymmetric key pair, also referred to as public-private key pairs. The basic idea is that two keys are generated, one for encrypting and one for decrypting. The encryption key is safe to distribute, the decryption key is kept private.

This innovation was pioneered in the late 1970s by two programmers and a mathematician, who gave their initials to the groundbreaking crypto system they invented: RSA. (An interesting side note: A similar system was invented several years earlier by a British intelligence mathematician, but the invention was kept secret and the system deemed impractical at the time given the limitations of computer systems.)

RSA and other asymmetric key systems take the idea of the one-way function a big step forward by creating two keys that work in an asymmetric fashion: The first key is used to create encrypted messages (the public key) and the second is used to decrypt them (the private key). See Figure 1.

Figure 1. Public-private keys

public key

The math behind this trick is not simple. In fact, for a time, the researchers involved held serious doubts as to whether it was even possible in theory. Today public-private key cryptography underlies much of modern internet security infrastructure, including the “transport layer” security used by SSL/TLS, digital signatures, and cryptocurrencies like Bitcoin.

It’s important to note that asymmetric keys do not create impossible-to-crack systems. But so long as the private key is kept private, it is practically impossible to break the encryption. Besides numerous in-the-wild exploits (including random number attacks, timing attacks, and others) that have been brought to light, the security of even the most secure public-private key pair is based on how long it would take to reverse the process of factoring the numbers involved.

This may not seem very secure, but to quote Brett Slatkin’s article on public key crypto math, “even fancy solutions on the fastest computer on Earth would take until the end of the universe” to crack modern asymmetric encryption. Barring the introduction of practical quantum computing, which would make cracking RSA-like encryption a polynomial time solvable problem (not necessarily a distant possibility), modern algorithms are considered viable for practical applications.

In current applications, asymmetric keys are often used as a kind of handshake to establish a secure channel for the exchange of symmetric keys. (This is what is happening when your browser is “negotiating TLS.”) Because symmetric keys are in practice much faster, the server and client verify each other via asymmetric keys, then hand over symmetric keys for use in further communication. This communication is then safe from eavesdropping or manipulation even over non-confidential channels.

Categories
3. Modern Cryptography

Pseudo-random functions

Along with one-way functions, algorithms for generating random-like numbers are considered cryptographic “primitives,” i.e., fundamental building blocks necessary for securing communications. Why is that? Simply put, any secret communication system depends on values that are known to the securing party, and unknown to the outside. That depends on generating random numbers. (Often, user supplied input is also incorporated, but humans are notoriously unreliable in providing such input.)

Most types of random seeding (like pulling from the system clock) are only “sort of” random. If a hacker knows how the numbers are generated, they could devise random number attacks. The ingenuity of hackers seems to keep pace with that of white hat coders. Indeed, the story of cryptography is one of back and forth jockeying, a kind of call and response of innovation.

More secure means of generating random numbers have been developed to foil random number attacks. Most crypto libraries include facilities for these generators.

Categories
3. Modern Cryptography

Symmetric ciphers

Cryptography before the advent of computers relied on the use of ciphers. A cipher is a mapping from readable text to gibberish, and back again. For instance, a simple cipher would be to add four to every letter in the text (so A becomes E). Decoding then would involve simply subtracting four from each letter. These processes are called encryption and decryption.

Shifting four places in the alphabet is very obvious, and not secure. More secure is creating a complex mapping that requires a key for translation. Such a key must be distributed to all participating parties. This necessity implies all sorts of logistical weaknesses.

Categories
3. Modern Cryptography

Public Key Cryptography

The history of general cryptography almost certainly dates back to almost 2000 B.C. when Roman and Greek statesmen used simple alphabet-shifting algorithms to keep government communication private. Although complexity increased, not much changed until the 1970s, when the National Security Agency (NSA) worked with Dr. Horst Feistel to establish the Data Encryption Standard (DES) and Whitfield Diffie and Martin Hellman introduced the first Public Key Cryptography Standard (PKCS). Windows Server 2003 still uses Diffie-Hellman (DH) algorithms for Secure Sockets Layer (SSL), Transport Layer Security (TLS), and IP Security (IPSec).

DH algorithms are known collectively as shared secret key cryptographies, also known as symmetric key encryption. Say you have two users, Greg and Matt, who want to communicate privately. With DH, Greg and Matt each generate a random number. Each of these numbers is known only to the person who generated it. Part one of the DH function changes each secret number into a non-secret, or public, number. Greg and Matt now exchange the public numbers and then enter them into part two of the DH function. This results in a private key – one that is identical to both users. Using advanced mathematics, this shared secret key can be decrypted only by someone with access to one of the original random numbers. As long as Greg and Matt keep the original numbers hidden, the shared secret key cannot be reversed.

Another major force in modern cryptography came about in the late 1970s. RSA Labs, founded by Ronald Rivest, Adi Shamir, and Leonard Adleman, furthered the concept of key cryptography by developing a technology of key pairs, where plaintext that is encrypted by one key can only be decrypted by the other matching key. Windows Server 2003 uses RSA technology in its various forms extensively for such things as Kerberos authentication and S/MIME. The theory goes something like this: Two users, Dave and Dixine, wish to communicate privately. Dave and Dixine each own a key pair consisting of a public key and a private key. If Dave wants Dixine to send him an encrypted message, he first transmits his public key to Dixine. She then uses Dave’s public key to encrypt the message. Fundamentally, since Dave’s public key was used to encrypt, only Dave’s private key can be used to decrypt. When he receives the message, only he is able to read it. Security is maintained because only public keys are transmitted – the private keys are kept secret and are known only to their owners. Figure 12.1 illustrates the process.

Categories
3. Modern Cryptography

Cryptography Primitives

Cryptography primitives are nothing but the tools and techniques in Cryptography that can be selectively used to provide a set of desired security services −

  • Encryption
  • Hash functions
  • Message Authentication codes (MAC)
  • Digital Signatures

The following table shows the primitives that can achieve a particular security service on their own.

Primitives Service

Note − Cryptographic primitives are intricately related and they are often combined to achieve a set of desired security services from a cryptosystem.

Categories
1. Introduction to Cryptography 3. Modern Cryptography

Security Services of Cryptography

The primary objective of using cryptography is to provide the following four fundamental information security services. Let us now see the possible goals intended to be fulfilled by cryptography.

Confidentiality

Confidentiality is the fundamental security service provided by cryptography. It is a security service that keeps the information from an unauthorized person. It is sometimes referred to as privacy or secrecy.

Confidentiality can be achieved through numerous means starting from physical securing to the use of mathematical algorithms for data encryption.

Data Integrity

It is security service that deals with identifying any alteration to the data. The data may get modified by an unauthorized entity intentionally or accidently. Integrity service confirms that whether data is intact or not since it was last created, transmitted, or stored by an authorized user.

Data integrity cannot prevent the alteration of data, but provides a means for detecting whether data has been manipulated in an unauthorized manner.

Authentication

Authentication provides the identification of the originator. It confirms to the receiver that the data received has been sent only by an identified and verified sender.

Authentication service has two variants −

  • Message authentication identifies the originator of the message without any regard router or system that has sent the message.
  • Entity authentication is assurance that data has been received from a specific entity, say a particular website.

Apart from the originator, authentication may also provide assurance about other parameters related to data such as the date and time of creation/transmission.

Non-repudiation

It is a security service that ensures that an entity cannot refuse the ownership of a previous commitment or an action. It is an assurance that the original creator of the data cannot deny the creation or transmission of the said data to a recipient or third party.

Non-repudiation is a property that is most desirable in situations where there are chances of a dispute over the exchange of data. For example, once an order is placed electronically, a purchaser cannot deny the purchase order, if non-repudiation service was enabled in this transaction.

Categories
3. Modern Cryptography

Context of Cryptography

Cryptology, the study of cryptosystems, can be subdivided into two branches −

  • Cryptography
  • Cryptanalysis
Cryptography Types

What is Cryptography?

Cryptography is the art and science of making a cryptosystem that is capable of providing information security.

Cryptography deals with the actual securing of digital data. It refers to the design of mechanisms based on mathematical algorithms that provide fundamental information security services. You can think of cryptography as the establishment of a large toolkit containing different techniques in security applications.

What is Cryptanalysis?

The art and science of breaking the cipher text is known as cryptanalysis.

Cryptanalysis is the sister branch of cryptography and they both co-exist. The cryptographic process results in the cipher text for transmission or storage. It involves the study of cryptographic mechanism with the intention to break them. Cryptanalysis is also used during the design of the new cryptographic techniques to test their security strengths.

Note − Cryptography concerns with the design of cryptosystems, while cryptanalysis studies the breaking of cryptosystems.

Categories
3. Modern Cryptography

Modern Cryptography

Modern cryptography is the cornerstone of computer and communications security. Its foundation is based on various concepts of mathematics such as number theory, computational-complexity theory, and probability theory.

Characteristics of Modern Cryptography

There are three major characteristics that separate modern cryptography from the classical approach.

Classic CryptographyModern Cryptography
It manipulates traditional characters, i.e., letters and digits directly.It operates on binary bit sequences.
It is mainly based on ‘security through obscurity’. The techniques employed for coding were kept secret and only the parties involved in communication knew about them.It relies on publicly known mathematical algorithms for coding the information. Secrecy is obtained through a secrete key which is used as the seed for the algorithms. The computational difficulty of algorithms, absence of secret key, etc., make it impossible for an attacker to obtain the original information even if he knows the algorithm used for coding.
It requires the entire cryptosystem for communicating confidentially.Modern cryptography requires parties interested in secure communication to possess the secret key only.