liveBook · Manning

Ciphertext

As explained in API Design Patterns

An encrypted value is data transformed by encryption so that its original content cannot be read without the required key or decryption process.

Ciphertext is encrypted data whose contents should remain unreadable to consumers without the required decryption process. In API pagination, keeping ciphertext opaque protects implementation flexibility: consumers cannot depend on internal token details that may later change. section 21.3.2

Represent encrypted values according to how they travel through an API:

  • Avoid numeric types: an integer cannot represent the encrypted data being stored. section 21.3.2
  • Prefer a string for transport convenience, especially when values appear in URLs or JSON. section 21.3.2
  • Use a Base64-encoded encrypted value serialized as UTF-8 when raw bytes are inconvenient. section 21.3.2

Opaque pagination token

A pagination API can return a string page token containing a Base64-encoded encrypted value. The consumer passes it back unchanged in a later request instead of inspecting or depending on its contents. section 21.3.2

How API Design Patterns covers it

How deep it goes
Explains representation trade-offs and transport encoding, but does not detail encryption algorithms or decryption internals.
Examples
Demonstrates encrypted pagination tokens passed as strings through URLs and JSON objects.
What it assumes
Assumes familiarity with pagination tokens, URLs, JSON objects, and raw bytes.
What you can do after
Apply it via an API by transporting encrypted values as opaque Base64-encoded strings.
How it connects
Connects ciphertext with page tokens, pagination, Base64, UTF-8, URLs, and JSON.

Also explained in

Compare how 5 books explain ciphertext →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.