错误类型

所有的错误类型都是基于``joserfc.errors.JoseError``。

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

该错误是为 JWS 设计的,当签名不匹配时触发。

error: str = 'bad_signature'

短字符串错误代码

exception joserfc.errors.ClaimError(claim: str)

This a base error for JWT claims validation.

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

描述此错误的长字符串

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

短字符串错误代码

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

该错误是为 JWS/JWE 设计的,当反序列化或解密失败时触发。

error: str = 'decode_error'

短字符串错误代码

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

该错误是为 DEF 压缩算法设计的,当压缩数据超过允许的最大长度时触发。

error: str = 'exceeded_size'

短字符串错误代码

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

该错误是为 JWT 设计的,令牌过期时触发。

description: str = 'The token is expired'

描述此错误的长字符串

error: str = 'expired_token'

短字符串错误代码

exception joserfc.errors.InsecureClaimError(claim: str)

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

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

描述此错误的长字符串

error: str = 'insecure_claim'

短字符串错误代码

exception joserfc.errors.InvalidCEKLengthError(cek_size: int)
description: str = "Invalid 'cek' length"

描述此错误的长字符串

error: str = 'invalid_cek_length'

短字符串错误代码

exception joserfc.errors.InvalidClaimError(claim: str)

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

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

描述此错误的长字符串

error: str = 'invalid_claim'

短字符串错误代码

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

描述此错误的长字符串

error: str = 'invalid_encrypted_key'

短字符串错误代码

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

该错误是为 JWE 设计的,当 "enc" 值与 "alg" 值不兼容时触发。

error: str = 'invalid_encryption_algorithm'

短字符串错误代码

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

此错误用于 EC 和 OKP 密钥,在密钥派生交换失败时触发。

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

描述此错误的长字符串

error: str = 'invalid_exchange_key'

短字符串错误代码

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

当给定的 header 值无效时触发该错误。

error: str = 'invalid_header_value'

短字符串错误代码

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

此错误用于 JWS,当密钥(EC、OKP)的曲线名称与指定算法不匹配时触发。

error: str = 'invalid_key_curve'

短字符串错误代码

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

此错误用于密钥集,当无法根据给定的密钥 ID 找到对应密钥时触发。

error: str = 'invalid_key_id'

短字符串错误代码

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

此错误用于 JWE。当密钥长度与指定算法不匹配时触发。

error: str = 'invalid_key_length'

短字符串错误代码

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

短字符串错误代码

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

此错误用于 JWT。当载荷(payload)不是有效的 JSON 对象时触发。

error: str = 'invalid_payload'

短字符串错误代码

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

此错误是为 JWT 设计的,当 Token 不是有效的 JSON 对象时触发。

description: str = 'The token is not valid yet'

描述此错误的长字符串

error: str = 'invalid_token'

短字符串错误代码

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

joserfc 中所有错误的基类异常。

description: str = ''

描述此错误的长字符串

error: str = ''

短字符串错误代码

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

当缺少算法("alg")时触发。

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

描述此错误的长字符串

error: str = 'missing_algorithm'

短字符串错误代码

exception joserfc.errors.MissingClaimError(claim: str)

此错误是为 JWT 设计的,当缺少必要的声明时会触发。

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

描述此错误的长字符串

error: str = 'missing_claim'

短字符串错误代码

exception joserfc.errors.MissingCritHeaderError(key: str)

当关键(crit) header 值不存在时触发。

error: str = 'missing_crit_header'

短字符串错误代码

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

此错误是为 JWE 设计的,当 header 中缺少 'enc' 值时会触发。

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

描述此错误的长字符串

error: str = 'missing_encryption'

短字符串错误代码

exception joserfc.errors.MissingHeaderError(key: str)

当 header 中缺少必要数据时会触发此错误。

error: str = 'missing_header'

短字符串错误代码

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

短字符串错误代码

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

短字符串错误代码

exception joserfc.errors.SecurityWarning

Base class for warnings of security issues.

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

此错误适用于 JWS 和 JWE,当注册表中不支持给定算法时触发。

error: str = 'unsupported_algorithm'

短字符串错误代码

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

当遇到不支持的 header 值时触发。

error: str = 'unsupported_header'

短字符串错误代码

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

短字符串错误代码

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

短字符串错误代码

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

短字符串错误代码