Skip to content

Conversation

@zztkm
Copy link
Contributor

@zztkm zztkm commented May 20, 2025

No description provided.

Comment on lines +275 to +276
let caCertString = """
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

検証する場合はここに CA Cert の文字列を指定します。

Comment on lines +358 to +363
let trustResult = SecTrustEvaluateWithError(serverTrust, &error)

if trustResult {
// 信頼できると評価された場合はサーバーの証明書を使って認証情報を作成する
Logger.debug(type: .webSocketChannel, message: "Server trust evaluation succeeded")
completionHandler(.useCredential, URLCredential(trust: serverTrust))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ローカルで iOS SDK クイックスタートに取り込んで試しているのですが、ここの trustResult は true になっていることがログ出力からわかるため、URLSession の SecTrustEvaluateWithError を用いたチェックは問題ないことがわかっています。

しかし、この処理が終わって handleServerTrustChallenge -> urlSession の処理を抜けると、ATS failed system trust というエラーが出てしまうのが現状の課題です。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Info.plist で CA 証明書を使うドメインの NSExceptionAllowsInsecureHTTPLoads を true に設定してあげるとカスタムしたサーバー証明書検証で検証OKになったあとに、ATS で落とされるという挙動をしなくなりました。

@zztkm
Copy link
Contributor Author

zztkm commented Jul 16, 2025

#264 で本番対応を進めているため、こちらの動作確認用ブランチは削除します。

@zztkm zztkm closed this Jul 16, 2025
@zztkm zztkm deleted the feature/test-ca-cert branch July 16, 2025 04:11
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.

2 participants