-
Notifications
You must be signed in to change notification settings - Fork 116
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
[86] Ignore [String]
JWK parameters
#116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xaverlohmueller, 👋
thanks so much for implementing this workaround. Sorry for the late reply we had a quite busy start of the week.
It already looks really good! Please have a look at my comments and tell me what you think. 🙂 Afterward we'll merge and release a new version with this workaround.
@@ -62,7 +62,7 @@ extension RSAPublicKey: Decodable { | |||
|
|||
// Other common parameters are optional. | |||
var parameters: [String: String] = [:] | |||
for key in commonParameters.allKeys { | |||
for key in commonParameters.allKeys where key != .X509CertificateChain { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also ignore the keyOperations
parameter, it is an array of strings as well.
for key in commonParameters.allKeys where key != .X509CertificateChain { | |
for key in commonParameters.allKeys where key != .X509CertificateChain && key != .keyOperations { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be awesome if you could also add the workaround to the decoding of RSAPrivateKey
here.
Tests/JWKx5cTests.swift
Outdated
@testable import JOSESwift | ||
|
||
class JWKx5cTests: XCTestCase { | ||
func testBuildingJWKSetShouldNotFailIfCertificatesArePresent() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test would probably fit nicely into JWKRSADecodingTests.swift
.
Hey, thanks for your review and suggestions for improvement! I implemented the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xaverlohmueller for the update to the pull request. Just one more thing: Please also ignore the keyOperations
parameter (it is a string array as well) to prevent the same bug from happening there. See my comments. 🙂
@@ -119,7 +119,7 @@ extension RSAPrivateKey: Decodable { | |||
|
|||
// Other common parameters are optional. | |||
var parameters: [String: String] = [:] | |||
for key in commonParameters.allKeys { | |||
for key in commonParameters.allKeys where key != .X509CertificateChain { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be awesome if you could also ignore the keyOperations parameter here and in the public key decoding.
for key in commonParameters.allKeys where key != .X509CertificateChain { | |
for key in commonParameters.allKeys where key != .X509CertificateChain && key != .keyOperations { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Let's get this merged. ✅
[String]
JWK parameters
Awesome! |
Thanks for your contribution @xaverlohmueller from my side as well! 👏 Just FYI: A new version with the merged changes will be released during the day. |
The 1.3.1 release is now live on CocoaPods! 🎉 |
Description
(Fixes #86)
This pull request provides a workaround for the
x5c
parameter, which isn't aString
but an Array of Strings ([String]
).The current behavior is to throw an error when serializing.
Please note that this is just a workaround for #86 and does not do any certificate validation (as planned in #57).