Skip to content

Commit

Permalink
Don't Base64.UrlSafe Encode x5c in Request (#812)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
suzannajiwani authored Dec 3, 2024
1 parent 6ff3d5a commit a2fa0ed
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import kotlinx.datetime.DateTimePeriod
import kotlinx.datetime.TimeZone
import kotlinx.datetime.plus
import kotlinx.io.bytestring.ByteString
import kotlinx.io.bytestring.encode
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
Expand All @@ -83,6 +84,7 @@ import java.net.NetworkInterface
import java.net.URLEncoder
import java.security.interfaces.ECPrivateKey
import java.security.interfaces.ECPublicKey
import kotlin.io.encoding.ExperimentalEncodingApi
import kotlin.random.Random

enum class Protocol {
Expand Down Expand Up @@ -823,6 +825,7 @@ lrW+vvdmRHBgS+ss56uWyYor6W7ah9ygBwYFK4EEACI=
Logger.i(TAG, "Sending handleOpenID4VPBegin response: $responseString")
}

@OptIn(ExperimentalEncodingApi::class)
private fun handleOpenID4VPRequest(
remoteHost: String,
req: HttpServletRequest,
Expand Down Expand Up @@ -870,7 +873,7 @@ lrW+vvdmRHBgS+ss56uWyYor6W7ah9ygBwYFK4EEACI=
)

val readerX5c = singleUseReaderKeyCertChain.certificates.map { cert ->
Base64.from(cert.encodedCertificate.toBase64Url())
Base64.from(kotlin.io.encoding.Base64.Default.encode(cert.encodedCertificate))
}

val request = lookupWellknownRequest(session.requestFormat, session.requestDocType, session.requestId)
Expand Down

0 comments on commit a2fa0ed

Please sign in to comment.