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.