Skip to content

why I modify genernated jwt a word, but verifier still success  #211

Closed
@justkuai

Description

@justkuai

`

    String key = "hello";

    String compactJws = Jwts.builder()
            .setSubject("Joe")
            .signWith(SignatureAlgorithm.HS512, key)
            .compact();

    String fakeCompactJws = compactJws.substring(0, compactJws.length() - 1) + "1"; // modify last the word to 1

    System.out.println("real jwt: " + compactJws);
    System.out.println("fake jwt: " + fakeCompactJws);

    System.out.println(Jwts.parser().setSigningKey(key).parseClaimsJws(fakeCompactJws).getBody().getSubject()); // why  'joe',  i'm modify a word 

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions