MCPcopy
hub / github.com/golang-jwt/jwt / TestRSAVerifyWithPreParsedPrivateKey

Function TestRSAVerifyWithPreParsedPrivateKey

rsa_test.go:86–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestRSAVerifyWithPreParsedPrivateKey(t *testing.T) {
87 key, _ := os.ReadFile("test/sample_key.pub")
88 parsedKey, err := jwt.ParseRSAPublicKeyFromPEM(key)
89 if err != nil {
90 t.Fatal(err)
91 }
92 testData := rsaTestData[0]
93 parts := strings.Split(testData.tokenString, ".")
94 err = jwt.SigningMethodRS256.Verify(strings.Join(parts[0:2], "."), decodeSegment(t, parts[2]), parsedKey)
95 if err != nil {
96 t.Errorf("[%v] Error while verifying key: %v", testData.name, err)
97 }
98}
99
100func TestRSAWithPreParsedPrivateKey(t *testing.T) {
101 key, _ := os.ReadFile("test/sample_key")

Callers

nothing calls this directly

Calls 2

decodeSegmentFunction · 0.85
VerifyMethod · 0.65

Tested by

no test coverage detected