Cryptography

Principles of cryptography

Dan Virgillito
October 8, 2020 by
Dan Virgillito

In layman’s terms, cryptography is the encryption and decryption of a written or text message between two parties. The practice relies on ciphers — a set of algorithms — to perform functions such as scrambling, descrambling, signing and hashing. Ciphers can be asymmetric or symmetric, based on the type of encryption they support.

Asymmetric and symmetric ciphers have similar roles, but they have their own pros and cons. In contrast, hash functions work differently and can be used for various purposes, but they are still cryptographic algorithms. Most ciphers have libraries that make implementation easy; however, this doesn’t offer much benefit if relevant ciphers aren’t secure.

Learn Applied Cryptography

Learn Applied Cryptography

Build your applied cryptography and cryptanalysis skills with 13 courses covering hashing, PKI, SSL/TLS, full disk encryption and more.

Principles that define a secure cipher

Ciphers can only be secure if cryptography principles used to define them are followed and implemented properly. Below, we break down the principles that form the basis of secure ciphers.

Kerckhoffs's principle

Auguste Kerckhoffs’ principle recommends that encryption algorithms should be public while the keys should be a secret. While it’s the preferred principle in the academic sector, other sectors prefer to keep their encryption algorithms also private as an added measure of safety. Kerckhoffs also had six principles of cipher design:

  • The system should be indecipherable in practice, if not theoretically
  • The system’s design should not require secrecy and its compromise should not be a hassle for a correspondent
  • The encryption key should be memorized and recalled without notes and should be convenient to modify
  • The system should have the ability to transmit the cryptograms by telegraph
  • The documents or equipment for the system should be easy to port and allow for one-person use
  • The system should be easy, neither carrying a long list of rules nor requiring mental strain for implementation

These principles are applied in all encryption algorithms, including AES (Advanced Encryption Standard), El Gamal and RSA (Rivest, Shamir, Adleman). Making algorithms secret could become a barrier to cryptanalysis, but only if the algorithms are implemented in a limited circle, as it helps secure the algorithms from unnecessary exposure. Government ciphers are usually kept secret.

Symmetric cryptography

A symmetric or “secret-key” cryptosystem utilizes the same key for encrypting and decrypting messages. A block cipher is commonly used to perform symmetric encryption, which involves dividing the plaintext into blocks of specifically fixed length and transforming each block to a certain algorithm to create a ciphertext block. Symmetric cryptography utilizes the same key and algorithm for decryption, reproducing the initial plaintext in return.

Most block ciphers are classified as “iterated block ciphers” that encrypt plaintext by a process containing several rounds. All rounds perform the same transformation by deriving a subkey from the initial input key. AES (Advanced Encryption Standard) is a great example of an iterated block cipher, which was used to replace the outdated DES (Data Encryption Standard) in government organizations. AES ciphers rely on 128-bit blocks and enable key sizes of 256, 192 or 128 bits. The rounds equate to 14, 12 or 10 based on which key size is used. The cipher is secure against most known techniques of cryptanalysis.

But symmetric encryption has a few shortcomings. The two main ones are key exhaustion and the key management problem. When the use of keys leaks some data that can be potentially used by an adversary to reconstruct keys, it is referred to as key exhaustion. Fortunately, using a key hierarchy that ensures that key-encryption or master keys are not overused can help protect against key exhaustion.

Public-key cryptography

The key distribution issue is a drawback of symmetric cryptography, but public-key distribution (aka. asymmetric cryptography) has no such shortcoming. In this cryptography method, algorithms rely on one key for encryption and a separate (yet related) key for decryption. Computationally, it’s infeasible for an attacker to identify the decryption key with the knowledge of only the encryption key and the cryptographic algorithm.

Public-key cryptography works on the following principles:

  • The plaintext must be fed into the algorithm as “input”
  • The encryption algorithm will conduct different transformations on the plaintext
  • Two sets of keys should be used where a public key is used for encryption, and a private key is used for decryption. The plaintext’s transformation will depend on the key selected from the set
  • The encryption algorithm’s output, i.e., ciphertext, will depend on the selected key. Each key, used one at a time with plaintext, would generate different ciphertexts
  • The decryption algorithm would accept the ciphertext and apply the relevant key to generate the original plaintext

The private key in this cryptography process is never shared and kept safe. The user of the public key must input two prime numbers that were used to create it. A brute-force attack might help crack smaller primes, but the use of large primes and advanced computing makes discovering the private key through such methods unlikely. Public-key cryptography can be used to encrypt email, share symmetric keys and perform many other processes that involve key sharing.

Principles of modern cryptography (provable security)

Modern cryptography involves the mathematical constructions of cryptographic protocols or primitives. The pattern of provable security helps in building and analyzing cryptosystems in an in-depth manner. Below are the major principles that apply to this process:

  • The precise definition of cryptosystem: The stakeholder needs to define the cryptosystem in question precisely. The definition should include details about what it means to crack the system, what is assumed as unknown to adversaries, the power that adversaries hold and what is that they’re trying to protect. The definition should be formulated with care so that it’s neither too weak nor difficult to comprehend.
  • Proof of security: Modern cryptographers aim to find provably secure schemes. As such, they should be able to associate a specified security model with the scheme. Proof of security is usually based on a formally defined model while relying on some computational assumptions.
  • Balanced assumptions: Assumptions, if applicable, should be made with caution. Also, cryptographers should use well-known conjectures in number theory over ad hoc ones.

Learn Applied Cryptography

Learn Applied Cryptography

Build your applied cryptography and cryptanalysis skills with 13 courses covering hashing, PKI, SSL/TLS, full disk encryption and more.

Conclusion

There’s no shortage of studies and reports of cryptanalysis breaking the unbreakable out there, but these principles of cryptography make for secure ciphers that are unfeasible to break. The more cryptographers rely on these principles, the stronger will be their ciphers. In the case of public-key encryption, ensuring private keys are secure and locked away is an effective way to keep ciphers secure.

 

Sources

Dan Virgillito
Dan Virgillito

Dan Virgillito is a blogger and content strategist with experience in cyber security, social media and tech news.