-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signature not valid according to jwt.io #192
Comments
@drewpitchford NSString *alg = @"HS256";
[JWTAlgorithmRSFamilyDataHolder new].algorithmName(alg); Something wrong here. Besides, try to separate code in pieces. NSString *alg = @"HS256";
id<JWTAlgorithmDataHolderProtocol> signHolder = [JWTAlgorithmRSFamilyDataHolder new].algorithmName(alg).secret([[self.sdkEphemeralPrivateKeyJwk dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0]); You can't check here secret that you pass to holder. Also you can't check data from which you create base64 string. NSString *alg = @"HS256";
NSData *secretData = [self.sdkEphemeralPrivateKeyJwk dataUsingEncoding:NSUTF8StringEncoding];
NSString *secretString = [secretData base64EncodedStringWithOptions:0];
id<JWTAlgorithmDataHolderProtocol> signHolder = [JWTAlgorithmRSFamilyDataHolder new]
.algorithmName(alg)
.secret(secretString); It becomes a bit readable. |
Yes, I agree it's not clean code. It's a proof of concept for now. I'll try RS256. |
@lolgear Does this lib support JWE? I don't see any specific mention of it anywhere. To be clear, JWE format such as |
@drewpitchford |
New Issue Checklist
Issue Info
Issue Description and Steps
I am integrating JWT into an SDK I am writing. When attempting to encrypt and sign some info to send to our server, I get errors in the signature. I double checked by pasting the encrypted data into jwt.io's tool. It decrypts the headers and payload fine; the only issue is "Signature is invalid". I've basically copy/pasted the example from the docs and still see this error. Below is my code
Is there something I'm missing here? I'd appreciate any help! Thanks!
The text was updated successfully, but these errors were encountered: