CodeSampleX

サンプル

Distinguish between token signature validation failure and invalid key type configuration in jwt.Parse

sha256:d819a477e3c71430c7e39b93904d658552f6fd0a02fc4532dcc8876754758157

PUBLISHED L3_CONTRACT_PASS MIT-0

ケース

ゴール
Distinguish between token signature validation failure and invalid key type configuration in jwt.Parse HOW
パッケージ
github.com/golang-jwt/jwt/v5 5.3.1
環境
go
作成日
2026-08-17T01:28:23Z

よくある思い込み

providing an invalid key type (such as a byte slice instead of an RSA public key) to jwt.Parse during RSA verification returns jwt.ErrTokenUnverifiable or jwt.ErrInvalidKeyType rather than jwt.ErrTokenSignatureInvalid

このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。

コントラクト

ファイル

検証済みアーティファクトをダウンロード (tar.gz) — 契約が実行された正確なバイト列

オリジンシーダー

csx-seed

検証レシート