Certopolis

CompTIA Security+ (SY0-801)

Symmetric vs asymmetric encryption: Security+ explained

Symmetric encryption uses the same secret key to encrypt and to decrypt. Asymmetric encryption uses a key pair: a public key that can be shared and a private key that must stay secret. Symmetric algorithms are much faster, so systems use asymmetric algorithms to set up a shared key and symmetric algorithms to encrypt the data.

Symmetric: one shared key

A symmetric-key algorithm uses a single key for an operation and its inverse. The key that encrypts the data also decrypts it, so the key must be kept secret by everyone who holds it.

AES is the preferred symmetric block cipher for new products. It works on 128-bit blocks with 128, 192 or 256-bit keys, named AES-128, AES-192 and AES-256. Triple DES (TDEA) is being retired: after December 31, 2023, three-key TDEA is disallowed for encrypting new data and may only be used to decrypt data already protected with it.

The weakness is key distribution. Every pair of parties that communicates needs its own shared key, so the number of keys grows quickly as more parties join.

Asymmetric: a public and private key pair

An asymmetric (public-key) algorithm uses two mathematically related keys. The public key can be published. The private key cannot be worked out from the public key and must stay secret.

Which key does what depends on the service. For encryption, the sender encrypts with the recipient's public key and only the recipient's private key decrypts. For a digital signature, the signer signs with their private key and anyone verifies with the public key.

Asymmetric algorithms are much slower than symmetric ones, so they are not used to encrypt large amounts of data.

The hybrid approach and key establishment

NIST describes the common pattern: asymmetric algorithms handle digital signatures and initial key establishment, and symmetric algorithms handle everything else, especially encrypting large amounts of data.

There are two ways to establish the shared key. In key agreement, both parties contribute values and each derives the same secret, so neither can choose it alone. Diffie-Hellman and MQV are the approved key-agreement algorithms. In key transport, one party generates the key, encrypts it with the receiver's public key (for example with RSA) and sends it, and the receiver decrypts it with its private key.

Example: two servers that have already exchanged public keys use them to establish a symmetric key, then encrypt their high-volume data stream with AES under that key.

Where the exam catches people

  • Believing asymmetric encryption should protect bulk data: it is much slower, so it sets up a symmetric key and the symmetric cipher encrypts the data.
  • Believing the sender encrypts with their own private key for confidentiality: encryption uses the recipient's public key, and only the recipient's private key decrypts.
  • Believing Diffie-Hellman encrypts and sends a key: it is key agreement, where both sides derive the same secret; sending an encrypted key chosen by one side is key transport, as with RSA.
  • Believing AES-256 has a 256-bit block: AES always uses 128-bit blocks; 256 is the key size.
  • Believing three-key Triple DES is still fine for new encryption: NIST disallowed it for applying protection after December 31, 2023.

Written from CompTIA's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. Two servers have already exchanged public keys and must keep a continuous, high-volume data stream between them confidential. Which of the following should encrypt the stream itself?

    Right. In the game that’s Renown for your General Security Concepts building.

    Not that one: B is right. In the game your General Security Concepts building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The servers use their public keys to agree on a symmetric key, then encrypt the stream with it.

    Written from nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-175Br1.pdf

  2. A client and a server share no secret in advance. During session setup, the client generates a random session key itself and sends it encrypted so that only the server can recover it. Which of the following algorithms performs this step?

    Right. In the game that’s Renown for your General Security Concepts building.

    Not that one: D is right. In the game your General Security Concepts building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    SP 800-56B Rev. 2 says that during key transport one party selects the secret keying material, which 'is then encrypted using RSA, and sent to the other party', using the receiver's public key.

    Written from nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br2.pdf

  3. Before encrypting a session, a browser and a web server that share no secret each send public values over the internet and combine them to derive the same secret. Which of the following does this step perform?

    Right. In the game that’s Renown for your General Security Concepts building.

    Not that one: B is right. In the game your General Security Concepts building would lose a little Renown, and this question would come back later.