Transparent encrypted storage¶
Name¶
Transparent encrypted storage
Summary¶
All data that has to be added to a storage system is automatically encrypted before it is actually written. All encryption and decryption actions happen transparently from the perspective of the entities using the storage system.
Parent¶
None
Problem¶
Solution¶
In this encrypted storage pattern encryption (and decryption) happen transparently from the perspective of the entities that want to write (or read) data to a storage system. In other words, the clients of the storage system do not request the cryptographic actions themselves, the storage system does this automatically for them. Consequently, this pattern will not stop data from leaking to attackers that interact with the storage system via legitimate clients. It does protect data a rest from an attacker with access the storage system through other means, e.g. physical access to the hard drive or server in question.
This pattern instantiates the Encryption pattern as an cryptographic layer in between the client entities and the actual storage entity.
Roles¶
- Writer (: Entity) wants to write one or more data elements to the
Data storage - Reader (: Entity) wants to read one or more data elements from the
Data storage - Crypto enforcer (: Entity) manages the read and write requests for the
Data store- Crypto enforcer <- Encryption.EntityA, Encryption.EntityB
- Cryptographer (: Cryptographic
primitive) a cryptographic primitive that can at least encrypt and decrypt data elements.
- Cryptographer <- Encryption.Encryption provider
- Data storage (: Storage) in which data stored persistently, e.g. a hard drive or database
Actions¶
- write (: Action) the provided data element(s) to the
Data storageunder the given identifier, if any - encrypt (: Action) a given plaintext
dusing the identified key and the given cipher configuration, if any - read (: Action) the data element(s) stored under the given identifier in
Data storage - decrypt (: Action) a given ciphertext
{d}_kusing the identified key and the given cipher configuration, if any
Note
Depending on the used cryptographic library the encrypt and decrypt actions may have to be refined into multiple calls to the library's API.
For example, it might be necessary to first instantiate the library with a configuration before encrypting or decrypting any data.
Data elements¶
- d (: Data) a plaintext data element
- d <- Encryption.plaintext
- {d}_k (: Data) a ciphertext obtained by encrypting plaintext
dwith cryptography keyk- {d}_k <- Encryption.ciphertext
- keyInfoE (: Data) information on the cryptographic key that should be used to encrypt the plaintext.
This can, for example, be an identifier so that the
Cryptographerknows which key to retrieve or the cryptographic key itself.- Tags: Untampered[, Secret]
- keyInfoE <- Encryption.keyInfo
- configE (: Data) the necessary information for the
Cryptographerto initialise the required encryption cipher. The exact (possible) values depend on the selected cryptographic library, some possible options are key length, mode, and block size.- Tags: Untampered
- ConfigE <- Encryption.config
- idW (: Data) the identifier under which the
Data storagehas to write the given data element(s) - idR (: Data) the identifier of the data element(s) the
Readerwants to retrieve - keyInfoD (: Data) information on the cryptographic key that should be used to decrypt the ciphertext.
This can, for example, be an identifier so that the
Cryptographerknows which key to retrieve or the cryptographic key itself.- Tags: Untampered[, Secret]
- keyInfoD <- Encryption.keyInfo
- configD (: Data) the necessary information for the
Cryptographerto initialise the required decryption cipher. The exact (possible) values depend on the selected cryptographic library, some possible options are key length, mode, and block size.- Tags: Untampered
- configD <- Encryption.config
- ack (: Data) a message indicating that data was successfully written to
Data storage(Optional) - error (: Data) a message indicating no data element(s) were found to match the provided identifier
Behaviour¶
Writing (new) data to Data storage (W.n flows)
- The
Writersends the plaintext datadto be stored to theCrypto enforcer, possibly accompanied by the identifier under which is should be stored. - The
Crypto enforcerforwards the received data to theCryptographeralong with the required key information and, optionally, a configuration for the encryption cipher. - The
Cryptographerperforms the requested encryption and replies the resulting ciphertext{d}_kto theCrypto enforcer. - The
Crypto enforcerforwards the received ciphertext to theData storageto actually store it. - The
Data storagewrites the received data and acknowledges this to theCrypto enforcer, possibly also providing the identifier under which the data was written. - The
Crypto enforcerforwards the acknowledgement and/or identifier to theWriter.
Reading stored data from Data storage (R.n flows)
- The
Readerrequests from theCrypto enforcerthe data element(s) stored under a given identifier. - The
Crypto enforcerrequests fromData storagethe ciphertext(s) stored under the given identifier. - The
Data storageretrieves the stored ciphertext(s){d}_k, if any, and replies them to theCrypto enforcer. - The
Crypto enforcerrequests theCryptographerto decrypt the retrieved ciphertext(s) using the identified key and, if provided, the decryption cipher configuration. - The
Cryptographerdecrypts the ciphertext(s) and replies the corresponding plaintext(s)dto theCrypto enforcer. - The
Crypto enforcerforwards the received plaintext(s) to theReader.

Role considerations¶
Identify sensitive data (Writer)¶
Crucial to determining which data should be encrypted before storage is to identify the sensitive data processed by the system. Once identified, it is advised to asses which sensitive data should be persistently stored and minimise this amount to what is strictly necessary for the system at hand.1 Data that is not stored cannot leak from storage. Furthermore, it should be avoided to cache data that was identified as sensitive as it could leak from such caches.
Encryption role considerations¶
All role considerations of the instantiated Encryption pattern should also be followed.
Data considerations¶
Encryption data considerations¶
All data considerations of the instantiated Encryption pattern should be followed.
Implementations¶
None
References¶
- Database-level encryption such as Transparent Data Encryption (TDE)
- Filesystem encryption such as LUKS or Bitlocker
-
OWASP, ‘Cryptographic Storage Cheat Sheet’, OWASP Cheat Sheet Series. https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html ↩