# Encryption Algorithms Concepts

If you’re planning to take the SY0-501 exam, you should have a good understanding of cryptography algorithms and their basic characteristics. This includes encryption algorithms.

For example, can you answer this practice test question?

Q. Your organization is investigating possible methods of sharing encryption keys over a public network. Which of the following is the BEST choice?

A. CRL

B. PBKDF2

C. Hashing

D. ECDHE

More, do you know why the correct answer is correct and the incorrect answers are incorrect? The answer and explanation are available at the end of this post.

## RSA

Ron Rivest, Adi Shamir, and Leonard Adleman developed RSA in 1977 and the **RSA **acronym uses their last names (Rivest, Shamir, Adleman). It is an asymmetric encryption method using both a public key and a private key in a matched pair, and it is widely used on the Internet and elsewhere due to its strong security.

As an example, email applications often use RSA to privately share a symmetric key between two systems. The application uses the recipient’s public key to encrypt a symmetric key, and the recipient’s private key decrypts it.

The RSA algorithm uses the mathematical properties of prime numbers to generate secure public and private keys. Specifically, RSA relies on the fact that it is difficult to factor the product of two large prime numbers. The math is complex and intriguing to mathematicians, but you don’t have to understand the math to understand that RSA is secure if sufficient key sizes are used.

What is a sufficient key size? RSA laboratories recommend a key size of 2,048 bits to protect data through the year 2030. If data needs to be protected beyond 2030, they recommend a key size of 3,072 bits.

## Static Versus Ephemeral Keys

The two primary categories of asymmetric keys are static and ephemeral. In general, a static key is semipermanent and stays the same over a long period of time. In contrast, an **ephemeral key **has a very short lifetime and is re-created for each session.

RSA uses static keys. A certificate includes an embedded public key matched to a private key and this key pair is valid for the lifetime of a certificate, such as a year. Certificates have expiration dates and systems continue to use these keys until the certificate expires. A benefit of static keys is that a CA can validate them. An ephemeral key pair includes a private ephemeral key and a public ephemeral key.

However, systems use these key pairs for a single session and then discard them. Some versions of Diffie-Hellman (discussed later in this section) use static keys and some versions use ephemeral keys.

**Perfect forward secrecy** is an important characteristic that ephemeral keys comply with asymmetric encryption. Perfect forward secrecy indicates that a cryptographic system generates random public keys for each session and it doesn’t use a deterministic algorithm to do so. In other words, given the same input, the algorithm will create a different public key. This helps ensure that systems do not reuse keys. The result is that the compromise of a long-term key does not compromise any past keys.

## Elliptic Curve Cryptography

Elliptic curve cryptography (ECC) doesn’t take as much processing power as other cryptographic methods. Because of this, ECC is often considered with common use cases of low-power devices. For example, ECC is often used with small wireless devices because it doesn’t take much processing power to achieve the desired security. It uses mathematical equations to formulate an elliptical curve. It then graphs points on the curve to create keys. This is mathematically easier and requires less processing power, while also being more difficult to crack.

The U.S. NSA previously endorsed the use of ECC for digital signatures and Diffie-Hellman key agreements. However, they announced in late 2015 their intent to move away from its use. Since then, they have deprecated the use of various ECC versions for government agencies.

## Diffie-Hellman

**Diffie-Hellman (DH) **is a key exchange algorithm used to privately share a symmetric key between two parties. Once the two parties know the symmetric key, they use symmetric encryption to encrypt the data.

Whitfield Diffie and Martin Hellman first published the Diffie-Hellman scheme in 1976. Interestingly, Malcolm J. Williamson secretly created a similar algorithm while working in a British intelligence agency. It is widely believed that the work of these three provided the basis for public-key cryptography.

Diffie-Hellman methods support both static keys and ephemeral keys. RSA is based on the Diffie-Hellman key exchange concepts using static keys. Two Diffie-Hellman methods that use ephemeral keys are:

**DHE.**Diffie-Hellman Ephemeral (DHE) uses ephemeral keys, generating different keys for each session. Some documents list this as Ephemeral Diffie-Hellman (EDH).**ECDHE.**Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) uses ephemeral keys generated using ECC. Another version, Elliptic Curve Diffie-Hellman (ECDH), uses static keys.

When Diffie-Hellman is used, the two parties negotiate the strongest group that both parties support. There are currently more than 25 DH (Diffie Hellman) groups in use and they are defined as DH Group 1, DH Group 2, and so on. Higher group numbers indicate the group is more secure. For example, DH Group 1 uses 768 bits in the key exchange process and DH Group 15 uses 3,072 bits.

Q. Your organization is investigating possible methods of sharing encryption keys over a public network. Which of the following is the BEST choice?

A. CRL

B. PBKDF2

C. Hashing

D. ECDHE

Answer is **D**. Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) allows entities to negotiate encryption keys securely over a public network and is the best choice of the available answers.

A certificate revocation list (CRL) identifies revoked certificates and is unrelated to sharing encryption keys.

Password-Based Key Derivation Function 2 (PBKDF2) is a key stretching technique designed to make password cracking more difficult.

Hashing methods do not support sharing encryption keys over a public network.

Note that some of these answers can easily be thrown out as unrelated to the question if you know what they are. For example, neither a CRL nor hashing is related to encryption keys and are obviously wrong. Further, if you remember that PBKDF2 is a key stretching technique used to make it more difficult to crack ** stored **passwords, you can eliminate it too because the question is focused on sharing encryption keys over a public network.