home-assistant / home-assistant/iOS

[mTLS] ECDSA P-521 verification failure

Open
#5,134 3 comments 0 reactions 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

### Preflight checks

- [x] I am using the experimental mTLS feature
- [x] I have reproduced this issue at least once after restarting the app

### App platform

iOS

### Device and app information

Model Name: iPhone 13
Device Identifier: -
OS Version: 26.5
App Version: 2026.7.0 (2026.2208)

### Home Assistant environment

HA Core Version:2026.4.4
Supervisor Version: not applicable
Installation Type: Container
Host OS: Debian
Reverse Proxy: Caddy
TLS Termination Point: Caddy

### mTLS setup details

Client Certificate Source: external private CA
Client Certificate Format: PKCS#12
Certificate validity window: 15/07/2026, 16:01 until 15/07/2027, 16:01
Signing CA type: private (without intermediate since some people had problems with that, I didn't try with an intermediate)
Server certificate issuer: Lets Encrypt
Full chain served by server: Yes

### Failure symptoms

Error message: The server “my.server.com” did not accept the certificate.
When does it fail: always (initial connect and on opening the app after rotating the client certificate)
Frequency: always
Time of most recent failure: 15/07/2026 18:20:38

### Steps to reproduce

1. Generate a Client Certificate (with ECDSA NIST P-521)
2. Setup Caddy for (m)TLS termination
3. Try connecting to the homeassistant instance
LMK if you need to see the mtls parts of my Caddy Config :)

### Expected vs actual behavior

Expected:
Connection establishing fine
Actual: Reverse Proxy rejects Client Certificate

### Additional context

I tried the exact same CA with the exact same device with an RSA (L: 4096) Client Certificate and it worked perfectly fine. I also use an ECDSA NIST P-521 Certificate with my Android and Desktop (Windows and Linux) Devices and it works perfectly fine. I therefore concluded that the error must be lying in the iOS App implementation. Caddy outputs the following error (already on debug logging, I captured these logs when figuring out where the actual error lies):
```
{"level":"debug","ts":1784228603.651014,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"ThisWasMyPrivateIpAddr","remote_port":"38177","subjects":["my.server.com"],"managed":true,"expiration":...,"hash":"..."}
{"level":"debug","ts":1784228603.7566674,"logger":"tls.client_auth.verifier.revocation.revocation","msg":"loading crl","crl":"http://CRL-URL/..."}
{"level":"debug","ts":1784228603.7654994,"logger":"tls.client_auth.verifier.revocation.revocation","msg":"signature of crl validated successfully","crl":"http://CRL-URL/..."}
{"level":"debug","ts":1784228603.7655265,"logger":"tls.client_auth.verifier.revocation.revocation","msg":"crl loaded successfully","crl":"http://CRL-URL/..."}
{"level":"debug","ts":1784228603.7786763,"logger":"http.stdlib","msg":"http: TLS handshake error from ThisWasMyPrivateIpAddr:38177: tls: invalid signature by the client certificate: ECDSA verification failure"}
```
There were no other logs concerning that TLS failure. The logs actually look like the problem lies within the ECDSA certificate but as mentioned above: I use multiple certificates with the exact same algorithm settings on my android, linux and windows devices where it works flawlessly (also with homeassistant on android).
Thank you already for taking a look at this and thanks for your work!

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is named. Start by reproducing the iOS connection with an ECDSA NIST P-521 PKCS#12 client certificate against the Caddy mTLS setup, then compare it with the working RSA certificate and other platforms. Done means the iOS client completes the TLS handshake successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
authentication, mobile-dev, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.