Errors#

All errors are based on joserfc.errors.JoseError.

exception joserfc.errors.BadSignatureError(description: str | None = None)#

This error is designed for JWS. It is raised when signature does not match.

error: str = 'bad_signature'#

short-string error code

exception joserfc.errors.ClaimError(claim: str, description: str | None = None)#

This a base error for JWT claims validation.

description: str = "Error claim: '{}'"#

long-string to describe this error

exception joserfc.errors.ConflictAlgorithmError(description: str | None = None)#
error: str = 'conflict_algorithm'#

short-string error code

exception joserfc.errors.DecodeError(description: str | None = None)#

This error is designed for both JWS and JWE. It is raised when deserialization and decryption fails.

error: str = 'decode_error'#

short-string error code

exception joserfc.errors.ExceededSizeError(description: str | None = None)#

This error is designed for validating the token’s content size. It raised when the data exceeds the maximum allowed length.

error: str = 'exceeded_size'#

short-string error code

exception joserfc.errors.ExpiredTokenError(claim: str, description: str | None = None)#

This error is designed for JWT. It raised when the token is expired.

description: str = 'The token is expired'#

long-string to describe this error

error: str = 'expired_token'#

short-string error code

exception joserfc.errors.InsecureClaimError(claim: str, description: str | None = None)#

This error is designed for JWT. It raised when the claim contains sensitive information.

description: str = "Insecure claim: '{}'"#

long-string to describe this error

error: str = 'insecure_claim'#

short-string error code

exception joserfc.errors.InvalidClaimError(claim: str, description: str | None = None)#

This error is designed for JWT. It raised when the claim contains invalid values or types.

description: str = "Invalid claim: '{}'"#

long-string to describe this error

error: str = 'invalid_claim'#

short-string error code

exception joserfc.errors.InvalidEncryptedKeyError(description: str | None = None)#
description: str = 'JWE Encrypted Key value SHOULD be an empty octet sequence'#

long-string to describe this error

error: str = 'invalid_encrypted_key'#

short-string error code

exception joserfc.errors.InvalidEncryptionAlgorithmError(description: str | None = None)#

This error is designed for JWE. It is raised when “enc” value does not work together with “alg” value.

error: str = 'invalid_encryption_algorithm'#

short-string error code

exception joserfc.errors.InvalidExchangeKeyError(description: str | None = None)#

This error is designed for EC and OKP keys. It is raised when exchanging derive key failed.

description: str = 'Invalid key for exchanging shared key'#

long-string to describe this error

error: str = 'invalid_exchange_key'#

short-string error code

exception joserfc.errors.InvalidHeaderValueError(description: str | None = None)#

Raised when the given header’s value is invalid.

error: str = 'invalid_header_value'#

short-string error code

exception joserfc.errors.InvalidKeyCurveError(description: str | None = None)#

This error is designed for JWS. It is raised when key’s curve name does not match with the given algorithm.

error: str = 'invalid_key_curve'#

short-string error code

exception joserfc.errors.InvalidKeyIdError(description: str | None = None)#

This error is designed for Key Set. It is raised when a key can not be found with the given key ID.

error: str = 'invalid_key_id'#

short-string error code

exception joserfc.errors.InvalidKeyLengthError(description: str | None = None)#

This error is designed for JWE. It is raised when key’s length does not align with the given algorithm.

error: str = 'invalid_key_length'#

short-string error code

exception joserfc.errors.InvalidKeyTypeError(description: str | None = None)#
error: str = 'invalid_key_type'#

short-string error code

exception joserfc.errors.InvalidPayloadError(description: str | None = None)#

This error is designed for JWT. It raised when the payload is not a valid JSON object.

error: str = 'invalid_payload'#

short-string error code

joserfc.errors.InvalidTokenError#

alias of InvalidClaimError

exception joserfc.errors.JoseError(description: str | None = None)#

Base Exception for all errors in joserfc.

description: str = ''#

long-string to describe this error

error: str = ''#

short-string error code

exception joserfc.errors.KeyParameterError(description: str | None = None)#
error: str = 'key_parameter'#

short-string error code

exception joserfc.errors.MissingAlgorithmError(description: str | None = None)#

Raised when an algorithm (“alg”) is missing.

description: str = "Missing 'alg' value in header"#

long-string to describe this error

error: str = 'missing_algorithm'#

short-string error code

exception joserfc.errors.MissingClaimError(claim: str, description: str | None = None)#

This error is designed for JWT. It raised when the required claims are missing.

description: str = "Missing claim: '{}'"#

long-string to describe this error

error: str = 'missing_claim'#

short-string error code

exception joserfc.errors.MissingCritHeaderError(key: str)#

This error happens when the critical header does not exist.

error: str = 'missing_crit_header'#

short-string error code

exception joserfc.errors.MissingEncryptionError(description: str | None = None)#

This error is designed for JWE. It is raised when the ‘enc’ value in header is missing.

description: str = "Missing 'enc' value in header"#

long-string to describe this error

error: str = 'missing_encryption'#

short-string error code

exception joserfc.errors.MissingHeaderError(key: str)#

This error happens when the required header does not exist.

error: str = 'missing_header'#

short-string error code

exception joserfc.errors.MissingKeyError(description: str | None = None)#
error: str = 'missing_key'#

short-string error code

exception joserfc.errors.MissingKeyTypeError(description: str | None = None)#
error: str = 'missing_key_type'#

short-string error code

exception joserfc.errors.SecurityWarning#

Base class for warnings of security issues.

exception joserfc.errors.UnsupportedAlgorithmError(description: str | None = None)#

This error is designed for both JWS and JWE. It is raised when the given algorithm is not supported in the registry.

error: str = 'unsupported_algorithm'#

short-string error code

exception joserfc.errors.UnsupportedHeaderError(description: str | None = None)#

Raised when an unsupported header is encountered.

error: str = 'unsupported_header'#

short-string error code

exception joserfc.errors.UnsupportedKeyAlgorithmError(description: str | None = None)#
error: str = 'unsupported_key_alg'#

short-string error code

exception joserfc.errors.UnsupportedKeyOperationError(description: str | None = None)#
error: str = 'unsupported_key_operation'#

short-string error code

exception joserfc.errors.UnsupportedKeyUseError(description: str | None = None)#
error: str = 'unsupported_key_use'#

short-string error code