uruk-project / Jwt

JSON Web Token implementation for .Net & .Net Core
MIT License
81 stars 13 forks source link

How to get payload decryption json? #503

Closed orangeagain closed 3 years ago

orangeagain commented 3 years ago

My current resolvent is decryption whole JWT.so i closet this issues

ycrumeyrolle commented 3 years ago

@orangeagain Can your share your solution? Is it an issue with documentation?

orangeagain commented 3 years ago

@orangeagain Can your share your solution? Is it an issue with documentation?

I Plan to encrypt whole token like this: RAW: {"alg": "HS256","typ": "JWT"}.{ "sub": "1234567890", "name": "John Doe", "iat": 1516239022}

after encrypt: {"alg": "HS256","typ": "JWT"}.ENCRYPTPAYLOAD

final,after signature: {"alg": "HS256","typ": "JWT"}.ENCRYPTPAYLOAD.SIGNATURE

I find different implement in your code. but you didn't throw decryption payload,you just valid it. can you throw payload json in decryption process?

JWT struct: header.PAYLOAD.signature

orangeagain commented 3 years ago

Throw payload json because I need read custom jsonobj custom json don't need to deserlized,just throw string or byte[]. and we can deserlized it use other library like utf8json.

orangeagain commented 3 years ago

I found a way.thank you https://github.com/ycrumeyrolle/Jwt/blob/master/samples/BinaryJwtCreationSample/Program.cs https://github.com/ycrumeyrolle/Jwt/blob/master/samples/JweValidationSample/Program.cs

ycrumeyrolle commented 3 years ago

You are right. If you need to encrypt a JWS, this is basicaly a JWE.