uruk-project / Jwt

JSON Web Token implementation for .Net & .Net Core
MIT License
85 stars 11 forks source link

How to get payload decryption json? #503

Closed orangeagain closed 4 years ago

orangeagain commented 4 years ago

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

ycrumeyrolle commented 4 years ago

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

orangeagain commented 4 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 4 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 4 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 4 years ago

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