Encryption can be used to protect data in all three of its states:
Encrypts data stored in servers and/or in databases. In the case of data exfiltration, or if the network/systems are compromised, the data will remain encrypted.
Example: AES , DES, and Triple DES.
Encrypts traffic between two entities or systems. It protects against MITM or sniffing, where even if the communication is intercepted, it becomes useless. Encryption is done at the transport layer. Upon receiving the message, the endpoint is authenticated, then data is decrypted and verified.
Example: TLS or Transport Layer Security is often used for encryption in transit.
Protects the data while it is being used to run analytics or computation.
Example: Format Preserving Encryption.