Skip to content
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

Don't Base64.UrlSafe Encode x5c in Request #812

Conversation

suzannajiwani
Copy link
Contributor

Used java.util.Base64.getEncoder() to encode the
the x5c instead.

Tested manually against java.util.Base64.getDecoder().decode to ensure decoding doesn't throw error.

@@ -870,7 +870,7 @@ lrW+vvdmRHBgS+ss56uWyYor6W7ah9ygBwYFK4EEACI=
)

val readerX5c = singleUseReaderKeyCertChain.certificates.map { cert ->
Base64.from(cert.encodedCertificate.toBase64Url())
Base64.from(java.util.Base64.getEncoder().encodeToString(cert.encodedCertificate))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should use kotlin.io.encoding.Base64 for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please don't use Java libraries.

Where is it defined how x5c is to be encoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, swapped to kotlin.io.encoding.Base64

@davidz25 the JSON Web Signature spec says here "Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded)"

Used java.util.Base64.getEncoder() to encode the
the x5c instead.

Tested manually against java.util.Base64.getDecoder()
.decode to ensure decoding doesn't throw error.

Signed-off-by: Suzanna Jiwani <[email protected]>
@suzannajiwani suzannajiwani force-pushed the openid4vp_verifier_x5c_encoding branch from 5d5a33c to fa35cfa Compare December 3, 2024 16:13
@suzannajiwani suzannajiwani merged commit a2fa0ed into openwallet-foundation-labs:main Dec 3, 2024
3 checks passed
@suzannajiwani suzannajiwani deleted the openid4vp_verifier_x5c_encoding branch December 3, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants