General Security Concepts · Topic 6 of 7

Encryption and Key Management

Compare symmetric and asymmetric encryption, key exchange, key length, encryption levels and key tools such as TPM, HSM, KMS and secure enclaves.

  • 5 min
In a nutshell
  • Symmetric uses one key and is fast. Asymmetric uses a key pair and is slower.
  • AES is the symmetric standard. RSA and ECC are asymmetric algorithms.
  • Encrypt with the recipient's public key, and the recipient decrypts with the private key.

What it is

Encryption turns readable data (plaintext) into unreadable data (ciphertext) with an algorithm and a key. Only someone with the right key can reverse it.

Two families exist. Symmetric encryption uses the same key to lock and unlock. Asymmetric encryption uses a mathematically linked pair: a public key that can be shared and a private key that is kept secret.

Choosing the right solution means picking the algorithm, the key length, the level at which data is encrypted and the tool that protects the keys.

Plaintextreadable dataencrypt with keyCiphertextunreadabledecrypt with keyPlaintextreadable again

How it works

Symmetric and asymmetric compared

FeatureSymmetricAsymmetric
KeysOne shared secret keyPublic and private key pair
SpeedFast, suited to large dataSlower, suited to small data
Main problemSharing the key safelyPerformance
AlgorithmsAdvanced Encryption Standard (AES)Rivest Shamir Adleman (RSA), elliptic curve cryptography (ECC)
Typical useDisk, file and bulk traffic encryptionKey exchange, digital signatures, certificates

Algorithms and key length

AES is the standard symmetric algorithm and supports 128, 192 and 256 bit keys. The Data Encryption Standard (DES) and Triple DES (3DES) are older and should not be chosen for new systems.

Longer keys are harder to brute force, because each extra bit doubles the number of possible keys. The trade off is more processing.

Key length only compares fairly within one algorithm type. ECC reaches the same strength as RSA with much shorter keys (a 256 bit ECC key is roughly as strong as a 3,072 bit RSA key), which suits phones and other small devices.

Key exchange and transport encryption

Real protocols combine the two families. Asymmetric methods agree on a session key, and then a fast symmetric cipher encrypts the actual traffic.

Clientbrowserasymmetric key exchangeServerweb siteshared session keyBoth sidessymmetric AES traffic

A key exchange method such as Diffie Hellman lets two parties build a shared secret over an open network without sending the key itself. When fresh temporary keys are used for each session, an old recorded session cannot be decrypted later if a long term key leaks. This property is called perfect forward secrecy.

Protocols

Transport or communication encryption protects data in motion. These are the protocols you will meet most often.

ProtocolProtects
Transport Layer Security (TLS)Web traffic (HTTPS), email transfer, many applications
Internet Protocol Security (IPsec)Network traffic between sites or hosts, often for a virtual private network (VPN)
Secure Shell (SSH)Remote command line sessions and file transfer

Older protocols such as Secure Sockets Layer (SSL) and early TLS versions have known weaknesses and should be disabled.

Levels of encryption

Encryption at rest can be applied at several levels.

LevelWhat is protected
Full diskEverything on a drive, including the operating system
PartitionOne partition of a disk
VolumeOne logical volume, which may span part of a disk or several disks
FileSingle files or folders
DatabaseA whole database
RecordSpecific rows or fields inside a database, such as card numbers

Full disk encryption protects a lost laptop but does not protect files once the system is unlocked and running. File, database and record encryption protect against someone who gets past the login, depending on who holds the keys.

Tools for holding keys

ToolWhat it does
Trusted platform module (TPM)A chip on a device that stores keys and checks that the boot process has not been changed
Hardware security module (HSM)A tamper resistant device or appliance that generates, stores and uses keys for many applications
Key management system (KMS)A service that creates, rotates, stores and retires keys centrally
Secure enclaveAn isolated area of a processor where sensitive operations run apart from the main operating system

A TPM belongs to one device. An HSM is shared infrastructure for servers and certificate authorities, and it is the stronger fit when keys are high value.

Good key management covers the full life of a key: generation, storage, distribution, rotation, revocation and destruction. Keys should never be stored next to the data they protect.

How the exam asks about this

  • "Protect the data on laptops if they are lost or stolen." -> Full disk encryption, usually with keys protected by a TPM.
  • "A certificate authority needs tamper resistant storage for its signing keys." -> An HSM.
  • "Only the card number column in a customer table must be encrypted." -> Record or field level database encryption.

What to remember for the exam

  • Symmetric uses one key and is fast. Asymmetric uses a key pair and is slower.
  • AES is the symmetric standard. RSA and ECC are asymmetric algorithms.
  • Encrypt with the recipient's public key, and the recipient decrypts with the private key.
  • Hybrid designs such as TLS use asymmetric methods to share a key, then symmetric encryption for the data.
  • Perfect forward secrecy depends on temporary session keys.
  • Longer keys are stronger within the same algorithm. ECC needs shorter keys than RSA.
  • TPM is a chip in one device. HSM is a dedicated hardware device for key operations.
  • A KMS manages the key lifecycle. A secure enclave isolates sensitive processing.
Exam tip

Match the level to the threat. A stolen device calls for full disk encryption. A database administrator who should not see card numbers calls for record level encryption.

Common mistakes

Saying asymmetric is always better. It is slower, so it is used for key exchange and signatures, and symmetric ciphers handle bulk data.

Mixing up which key does what. For confidentiality, the sender uses the recipient's public key. Using the private key to sign is a different use.

Treating a TPM and an HSM as the same. A TPM is tied to one machine, while an HSM serves many systems and offers stronger physical protection.

Ignoring key rotation. Long lived keys give an attacker more time to break or steal them.

Watch out

Losing a key without a recovery plan means losing the data. Plan for escrow or backup of keys before encrypting important data.

Check yourself

  • Which kind of encryption is used for bulk data in a TLS session?

    Symmetric encryption, using a session key that was agreed through asymmetric methods.

  • What is the difference between a TPM and an HSM?

    A TPM is a chip bound to a single device. An HSM is a dedicated, tamper resistant device that manages keys for many applications.

  • What does perfect forward secrecy protect against?

    It stops an attacker from decrypting old recorded sessions after a long term key is stolen.

Topic 6 of 7 in General Security Concepts

Test yourself on General Security Concepts

The full CompTIA Security+ SY0-801 question bank has 998 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by CompTIA. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.