# openssl verify error:num=62:Hostname mismatch / Verify return code: 62

**Code:** `error 62` · **Category:** SSL / TLS · **Seen on:** OpenSSL, SSL

The certificate is valid but not for the hostname you connected to or asked OpenSSL to check.

## Meaning

Check the SAN list (`openssl x509 -noout -ext subjectAltName`), connect with the exact hostname (and `-verify_hostname`), and note that the Common Name is ignored when SANs exist. IP connections need an IP SAN.

## Common causes

- Hostname not in the SAN list
- Connecting via IP or alias
- Wildcard doesn't cover the level
- Wrong certificate deployed
- Old CN-only certificate

## Quick fix

1. Reissue with the correct SAN entries
2. Use the hostname that matches
3. Add an IP SAN for IP-based access

## Detailed fix by platform

### Shell

1. 

```bash
openssl x509 -in cert.pem -noout -ext subjectAltName
openssl s_client -connect host:443 -verify_hostname www.example.com
```


## How to diagnose

1. **SAN** — Contains hostname?
2. **Connection** — By name?
3. **Wildcard** — Right level?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ssl/openssl-verify-error-hostname-mismatch)
