TLS & PKI Security 6 min read · Last verified 2026-11-25

X.509 TLS Certificates & Chain Errors Explained: SAN Extensions, Intermediates & Offline OpenSSL Checks

Every web engineer eventually encounters the 'works in my browser, fails in curl and Go' TLS mystery: Chrome shows a happy padlock, yet mobile apps, Python requests, and Cloudflare Full (Strict) immediately fail with unable to verify the first certificate or HTTP 526. Understanding X.509 chains, SAN extensions, and ASN.1 decoding resolves these incidents permanently.

Primary References: RFC 5280 (X.509 PKI), RFC 6125, TLS 1.3 (RFC 8446) · Author: NetDevKit Engineering Team

1. Leaf vs. Intermediate vs. Root: Why cert.pem Breaks Production

Operating systems and browsers ship a curated trust store of Root CA certificates, NOT the hundreds of Intermediate CAs that actually sign your server's leaf certificate. During a TLS handshake, your web server (Nginx, Caddy, Envoy, or ALB) is responsible for presenting both your leaf certificate AND the issuing intermediate certificate(s) concatenated in leaf-first order inside fullchain.pem.

Why did Chrome succeed when you accidentally configured cert.pem alone? Desktop browsers implement Authority Information Access (AIA) chasingβ€”silently downloading missing intermediate certificates over HTTP in the background. CLI tools (curl, openssl), Go/Python SDKs, and CDN edge validators deliberately skip AIA fetching for security and latency, immediately rejecting incomplete chains.

# Correct fullchain.pem order (leaf FIRST, intermediate CA SECOND; omit root CA):
cat leaf.crt intermediate.crt > fullchain.pem

# Inspect the live chain sent by a server with explicit SNI
openssl s_client -connect netdevkit.com:443 -servername netdevkit.com -showcerts </dev/null

# Verify that a private key mathematically matches a leaf certificate
openssl x509 -noout -pubkey -in fullchain.pem | openssl sha256
openssl pkey -pubout -in privkey.pem | openssl sha256

2. Why Common Name (CN) Is Deprecated in Favor of SAN (OID 2.5.29.17)

U

n

d

e

r

R

F

C

5

2

8

0

a

n

d

m

o

d

e

r

n

C

A

/

B

r

o

w

s

e

r

F

o

r

u

m

r

u

l

e

s

,

T

L

S

c

l

i

e

n

t

s

i

g

n

o

r

e

t

h

e

S

u

b

j

e

c

t

C

o

m

m

o

n

N

a

m

e

(

C

N

)

w

h

e

n

e

v

e

r

v

a

l

i

d

a

t

i

n

g

h

o

s

t

n

a

m

e

s

.

E

v

e

r

y

c

o

v

e

r

e

d

h

o

s

t

n

a

m

e

β€”

i

n

c

l

u

d

i

n

g

b

o

t

h

t

h

e

a

p

e

x

d

o

m

a

i

n

(

e

x

a

m

p

l

e

.

c

o

m

)

a

n

d

w

w

w

/

w

i

l

d

c

a

r

d

v

a

r

i

a

n

t

s

(

*

.

e

x

a

m

p

l

e

.

c

o

m

)

,

o

r

I

P

l

i

t

e

r

a

l

s

f

o

r

i

n

t

e

r

n

a

l

K

u

b

e

r

n

e

t

e

s

/

e

t

c

d

e

n

d

p

o

i

n

t

s

β€”

m

u

s

t

a

p

p

e

a

r

i

n

s

i

d

e

t

h

e

X

5

0

9

v

3

S

u

b

j

e

c

t

A

l

t

e

r

n

a

t

i

v

e

N

a

m

e

(

S

A

N

)

e

x

t

e

n

s

i

o

n

.

R

e

m

e

m

b

e

r

a

l

s

o

t

h

a

t

a

w

i

l

d

c

a

r

d

*

.

e

x

a

m

p

l

e

.

c

o

m

c

o

v

e

r

s

e

x

a

c

t

l

y

o

n

e

s

u

b

d

o

m

a

i

n

l

a

b

e

l

(

a

p

i

.

e

x

a

m

p

l

e

.

c

o

m

)

,

N

O

T

m

u

l

t

i

-

l

e

v

e

l

h

o

s

t

s

l

i

k

e

v

1

.

a

p

i

.

e

x

a

m

p

l

e

.

c

o

m

o

r

t

h

e

b

a

r

e

a

p

e

x

e

x

a

m

p

l

e

.

c

o

m

.

3. Why Never Paste Internal PKI Certificates into Server-Backed Decoders

E

v

e

n

t

h

o

u

g

h

p

u

b

l

i

c

c

e

r

t

i

f

i

c

a

t

e

s

d

o

n

o

t

c

o

n

t

a

i

n

y

o

u

r

p

r

i

v

a

t

e

k

e

y

,

i

n

t

e

r

n

a

l

c

o

r

p

o

r

a

t

e

P

K

I

c

e

r

t

i

f

i

c

a

t

e

s

a

n

d

C

S

R

s

e

x

p

o

s

e

i

n

t

e

r

n

a

l

h

o

s

t

n

a

m

e

s

,

p

r

i

v

a

t

e

I

P

S

A

N

s

,

a

n

d

a

c

t

i

v

e

i

n

f

r

a

s

t

r

u

c

t

u

r

e

t

o

p

o

l

o

g

i

e

s

.

D

e

c

o

d

i

n

g

P

E

M

A

S

N

.

1

D

E

R

s

t

r

u

c

t

u

r

e

s

s

t

r

i

c

t

l

y

i

n

s

i

d

e

l

o

c

a

l

b

r

o

w

s

e

r

J

a

v

a

S

c

r

i

p

t

(

a

n

d

c

h

e

c

k

i

n

g

t

h

a

t

t

h

e

b

u

n

d

l

e

a

c

t

u

a

l

l

y

c

o

n

t

a

i

n

s

2

+

c

e

r

t

i

f

i

c

a

t

e

s

!

)

e

l

i

m

i

n

a

t

e

s

s

e

r

v

e

r

-

s

i

d

e

l

o

g

g

i

n

g

e

x

p

o

s

u

r

e

c

o

m

p

l

e

t

e

l

y

.

Companion Offline NetDevKit Calculators

Apply the formulas from this guide immediately in your browser with zero server uploads:

Frequently Asked Questions

Should I include the Root CA certificate inside fullchain.pem?

No. Including the self-signed Root CA wastes bytes on every TLS handshake because clients only trust Root CAs already installed in their own local trust store. Include only your leaf certificate followed by intermediate CA certificates.

Does a *.example.com wildcard certificate cover example.com or a.b.example.com?

No. A wildcard SAN (*.example.com) matches exactly one subdomain label (such as api.example.com). To cover the apex domain, add example.com as a separate SAN entry alongside *.example.com.

Can an attacker compromise my server if they see my .crt or fullchain.pem?

Noβ€”certificates contain only the public key and identity metadata, which your server already sends to every visitor during TLS handshakes. Only your privkey.pem file must remain strictly secret.

More Engineering Guides

Copied to clipboard