Skip to Content
oxcrypto

PASETO v3

PASETO v3.local (AES-256-CTR and HMAC-SHA-384) and v3.public (ECDSA P-384).

from oxcrypto.paseto import PASETO
from oxcrypto.signature.ecdsa import ECDSA

key = ECDSA.P384.generate()
token = PASETO.V3_PUBLIC.encode(b"message", key, implicit_assertion=b"ctx")
assert PASETO.V3_PUBLIC.decode(token, key.public_key(), implicit_assertion=b"ctx") == b"message"
SelectorKeyConstruction
V3_LOCAL32-byte bytesHKDF-SHA-384 splits the key with a random 32-byte nonce into an AES-256-CTR key and counter and an HMAC-SHA-384 key; encrypt-then-MAC over the PAE of header, nonce, ciphertext, footer and implicit assertion
V3_PUBLICECDSAPrivateKey / ECDSAPublicKey on P-384ECDSA P-384 with SHA-384 over the PAE of the compressed public key, header, message, footer and implicit assertion

An ECDSA key on another curve raises ValueError. ECDSA nonces are deterministic (RFC 6979), as the specification recommends.