Skip to content

Commit

Permalink
enable client auth (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc authored Oct 16, 2024
1 parent a8f3643 commit 62f3c72
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions Networking/Sources/MsQuicSwift/QuicConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public final class QuicConfiguration: Sendable {

let flags = 0
| (client ? QUIC_CREDENTIAL_FLAG_CLIENT.rawValue : 0)
| (client ? 0 : QUIC_CREDENTIAL_FLAG_REQUIRE_CLIENT_AUTHENTICATION.rawValue)
// we validates it ourselves
| QUIC_CREDENTIAL_FLAG_NO_CERTIFICATE_VALIDATION.rawValue
// we need custom validation of the certificate
Expand Down
15 changes: 13 additions & 2 deletions Networking/Tests/NetworkingTests/PKCS12Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct PKCS12Tests {

try? await Task.sleep(for: .milliseconds(50))

let data = clientHandler.events.value.compactMap {
let clientData = clientHandler.events.value.compactMap {
switch $0 {
case let .shouldOpen(_, certificate):
certificate as Data?
Expand All @@ -66,6 +66,17 @@ struct PKCS12Tests {
}
}

#expect(data.first!.count > 0)
#expect(clientData.first!.count > 0)

let serverData = serverHandler.events.value.compactMap {
switch $0 {
case let .shouldOpen(_, certificate):
certificate as Data?
default:
nil
}
}

#expect(serverData.first!.count > 0)
}
}

0 comments on commit 62f3c72

Please sign in to comment.