Paragon Initiative Enterprises Blog

The latest information from the team that develops cryptographically secure PHP software.

Introducing PASERK, the First PASETO Extension, for Key Wrapping and Serialization

When we designed PASETO, our goal was to provide an easy-to-use, secure-by-default, and simple protocol that solves the same sort of problems as JSON Web Tokens (except actually secure).

This resulted in two types of PASETO token being defined for each version of the protocol:

  1. Local tokens: Symmetric authenticated encryption
  2. Public tokens: Asymmetric digital signatures

This solved the majority of use cases, but not all: If you wanted to use public-key encryption instead of symmetric-key encryption, you couldn't accomplish that with PASETO. Put flatly, there was no JWK-equivalent for PASETO.

With that in mind, today we'd like to announce the first PASETO extension:

Platform-Agnostic SERializd Keys (PASERK)

PASERK provides the key-wrapping and serialization features missing from PASETO (which we excluded from PASETO to keep code sizes and complexity small; nobody wants to implement a standard that includes everything including the kitchen sink).

Serialized PASETO keys are always in the format


The version number in a PASERK must match the protocol version number of the corresponding PASETO token. Additionally, each PASERK type encodes a key that can only be used with a specific PASETO purpose.

Although we haven't declared the PASERK specification final yet, we do have a reference implementation in PHP available. Don't deploy PASERK in production until we tag v1.0.0.

Key Serialization

The most obvious feature of PASERK is the ability to unambiguously encode PASETO keys.

PASERK TypeMeaningPASETO Compatibility
local Symmetric key for local tokens. local
public Public key for verifying public tokens. public
secret Secret key for verifying secret tokens. public

Key Serialization Examples




Key Wrapping

PASERK allows you to wrap symmetric keys (for local tokens) and asymmetric secret keys (for public tokens) with a symmetric key.

PASERK TypeMeaningPASETO Compatibility
local-wrap Symmetric key wrapped by another symmetric key. local
secret-wrap Asymmetric secret key wrapped by another symmetric key. public

PASERK key-wrapping is intentionally designed to allow vendors to specify their own key-wrapping procedures, provided they reserve a unique identifier in the PASERK specification (to ensure interoperability).

We hope this makes PASERK useful for integrating with cryptographic material management services.

However, we also provide a standard implementation out-of-the-box.

Key-Wrapping Examples



Public-Key Encryption

PASERK allows you to use public-key encryption to wrap ephemeral symmetric keys, which you can in turn use with local PASETO tokens.

PASERK TypeMeaningPASETO Compatibility
seal Symmetric key wrapped using asymmetric encryption. local

Public-Key Encryption Example


Password-Based Key-Wrapping

Want to protect a PASETO key with a password? PASERK lets you do that too.

PASERK TypeMeaningPASETO Compatibility
local-pw Symmetric key wrapped using password-based encryption. local
secret-pw Asymmetric secret key wrapped using password-based encryption. public

Password-Based Key Wrapping Examples



Universally Unique Key Identifiers

Finally, PASETO offers a unique and unambiguous way to calculate Key IDs from a given PASETO key.

PASERK TypeMeaningPASETO Compatibility
lid Unique Identifier for a separate PASERK for local PASETOs. local
pid Unique Identifier for a separate PASERK for public PASETOs. (Public Key) public
sid Unique Identifier for a separate PASERK for public PASETOs. (Secret Key) public

Key Identification Examples



About the Author

P.I.E. Staff

Paragon Initiative Enterprises

Paragon Initiative Enterprises is a Florida-based company that provides software consulting, application development, code auditing, and security engineering services. We specialize in PHP Security and applied cryptography.

Need Technology Consultants?

Will tomorrow bring costly and embarrassing data breaches? Or will it bring growth, success, and peace of mind?

Our team of technology consultants have extensive knowledge and experience with application security and web/application development.

We specialize in cryptography and secure PHP development.

Let's Work Together Towards Success

Our Security Newsletters

Want the latest from Paragon Initiative Enterprises delivered straight to your inbox? We have two newsletters to choose from.

The first mails quarterly and often showcases our behind-the-scenes projects.

The other is unscheduled and gives you a direct feed into the findings of our open source security research initiatives.

Quarterly Newsletter   Security Announcements