From magazine topic to project implementation
Relevant service and technical pages for this post
Reader question: „Why does the HTTPS call from my Delphi/Indy client fail at the customer’s site, even though the same endpoint works in the browser — and the log only shows something about EIdSSL…?“
Short answer: For Indy: HTTPS calls with a private CA three things must be correct at the same time: (1) OpenSSL must actually be loadable and compatible in your application, (2) the TLS handshake (version, cipher, proxy path) must complete, and (3) the certificate verification must build a chain up to a trusted trust anchor. Certificate pinning intentionally adds a fourth hurdle on top of that — which also creates additional failure modes.
If you want to resolve the problem quickly, you must not „tinker with certificates somewhere.“ You must first hit the correct class of error. Then EIdSSL* becomes a concrete task: fix deployment, isolate the handshake, or correct the trust/chain. That is exactly what this article is designed for: a clean approach, typical edge cases and debugging hints that work in operation.
Why „Indy: HTTPS calls with a private CA“ often fails in projects
Indy typically performs HTTPS via TIdSSLIOHandlerSocketOpenSSL (IOHandler for TLS over OpenSSL). That practically means: not Windows SChannel (the Windows TLS stack) decides trust and compatibility, but OpenSSL — including its own trust logic (CA bundle, verify path).
Two recurring surprises arise from that:
- „The root CA is in the Windows store“ is not automatically sufficient for your Indy/OpenSSL client. The trust must be available in the OpenSSL context.
- „It works in the browser“ is not proof. Browsers are often more tolerant about TLS details, use OS trust and have sophisticated fallbacks.
Additionally there is the corporate-network reality: proxies, SSL inspection (TLS interception), AV/firewall with TLS filtering. In that case your client does not really „talk“ to the target server, but to a system that terminates TLS and rebuilds it with its own certificate. For standard PKI verification this can still work (under a Corporate-CA). For pinning it is, without explicit design, almost always a hard break.
Separate first, then solve: three classes of errors behind EIdSSL*
Many Indy exceptions look similar because in the end only „TLS broken“ is reported. For a quick diagnosis it is more important to know when it fails: before the handshake (Library), during the handshake (Negotiation) or during verify (Trust/chain).
| Error class | Typical symptoms | Likely cause | First check |
|---|---|---|---|
| Library/Runtime | „Could not load SSL library“, abort before handshake | OpenSSL DLLs missing/incompatible, 32/64-bit mismatch, search path/dependencies | Verify deployment and dependencies are reproducible |
| Handshake/Negotiation | Handshake failed, method/protocol errors, network-dependent | TLS version/cipher mismatch, proxy/inspection, SNI/ALPN effects | openssl s_client, proxy path, TLS policy |
| Certificate verification/Trust | Verify errors (e.g. 20/19), hostname/expiry, „self-signed…“ | CA not in the trust context, incomplete chain, wrong hostname, expired | Make chain/issuer/trust anchor visible |
Rule of thumb: if the SSL library fails to load, there is no handshake. If the handshake fails, trust is often not even reached yet. And when trust fails, it is rarely „Indy misbehaving“—almost always a chain, store or proxy issue.
Private CA: What OpenSSL really expects during Verify
OpenSSL verifies a certificate chain for TLS (simplified): server certificate (leaf) → intermediate certificate(s) (Intermediate) → trust anchor (Trust Anchor, usually the root CA). Without a Trust Anchor the result is “not trusted” — regardless of whether the leaf is technically correct.[Source]
Practical consequence for a private PKI: you must explicitly provide the Trust Anchor for your application. In OpenSSL stacks this is typically a CA bundle (PEM/CRT file) or a defined verify path. And you must understand what the server must deliver: leaf plus intermediates. The root CA is normally not sent; it is present locally as the Trust Anchor.
That sounds like a detail, but it is an operational point: if the server does not send the intermediates, the client cannot complete the chain — even if the root CA is present.
Verify error 20: “unable to get local issuer certificate” is almost always chain or trust
OpenSSL verify error 20 means: the verifier cannot find a matching issuer certificate locally to verify the chain.[Source] The two main causes are:
- Client-side missing issuer/trust: root/intermediate are not available in the OpenSSL trust context (CA bundle/verify path incorrect or incomplete).
- Server-side the chain is incomplete: an intermediate is not sent or is delivered incorrectly.
Both look similar in the logs, but require completely different fixes. That is exactly why error 20 is not a “final diagnosis”, but only an indicator.
The quick cross-check: view the chain from the server
For a clear separation, openssl s_client -showcerts has become the standard: you can see which certificates the server actually sends. If intermediates are missing, server configuration is the first point to fix. If the chain is complete, the issue is more likely with local trust (CA bundle/Trust Anchor) or the proxy path.[Source]
Limitation: s_client tests the path you give it. If your production client must go through a proxy/inspection and s_client connects directly to the Internet, you are not testing the same failure. You therefore also need a clear answer as to whether TLS inspection is active and what the proxy path looks like.
Certificate pinning: additional protection, additional failure mode
Pinning means the client only accepts an expected certificate or an expected public key (usually as a hash/fingerprint) for a host. If that differs, the connection is aborted — even if the CA chain would be formally valid. That pinning constitutes its own error case (Pin-Mismatch) is, for example, documented as a separate case in Chromium’s network error definitions.[Source]
This also explains why pinning can become difficult in corporate networks: if a proxy terminates TLS, the client no longer „sees“ the server certificate but the proxy certificate. Your pins then no longer match — and from the perspective of pinning they should not.
When pinning makes sense
- You control the target servers and the client update path (including services without a UI).
- You plan certificate changes: roll-over with at least two valid pins running in parallel.
- You know whether proxies/inspection are present and have made a decision (support them, bypass them, or consciously not support them).
If these points are not met, pinning is often not „more security“ but „more disruption“, which manifests as sporadic outages (because it only triggers during a certificate change or when moving into a different customer network).
Typical Indy/OpenSSL errors: meaning and initial assessment
The names of the exceptions are helpful if you place them in the correct phase. Three cases are particularly typical.
„Could not load SSL library“: deployment rather than certificate discussion
If Indy cannot load the OpenSSL libs, any analysis of certificate chains, CAs or pinning is a waste of time. Typical causes:
- DLLs are missing from the search path (service deployment is often stricter here than interactive startup).
- The OpenSSL version does not match Indy’s expectation (ABI/build compatibility).
- 32/64-bit mismatch or missing dependencies.
That Indy requires matching OpenSSL DLLs for HTTPS and otherwise fails with „Could not load SSL library“ is regularly confirmed in practice around Indy/OpenSSL.[Quelle] Operational implication: ship OpenSSL as a versioned component of your application (CI artifact/installer) and treat it like a system dependency, not like „it’s installed somewhere“.
EIdOSSLGetMethodError: TLS method/version incompatible with the library
If you force a protocol method/TLS version in Indy that the deployed OpenSSL version does not provide, an exception is to be expected. Indy explicitly describes this relationship as the result of an unavailable protocol selection in the SSL options.[Quelle]
In practice this means: don’t tinker with the CA, but check compatibility. What does the server accept (policy)? What can your OpenSSL version do? And is there a proxy in the customer’s network that terminates the TLS portion differently than your test environment?
„SSL handshake failed“: a catch-all where proxies often hide
Handshake failures are not automatically „trust broken.“ Causes range from protocol/cipher incompatibility through expired/hostname-mismatched certificates to interference by proxy/AV/firewall. This breadth is also emphasized in general troubleshooting guides.[Quelle]
Conclusion: if you see „handshake failed“, you first need clarity about the network path and TLS parameters. Only then does the trust question make sense to answer.
Constructed example: „It fails at the customer’s, not at ours“
Debugging procedure: sequence of steps that actually closes tickets
The process must produce evidence, not guesses. This allows developers, technical leads and admins to work in parallel without talking past each other.
- Fix the context: Hostname/port, affected machine, time window, direct route or proxy, recent changes (certificate/server update/network policy). Without these facts, TLS discussions are unproductive.
- Clear the library layer: For „Could not load SSL library“ resolve deployment first (correct DLLs, correct architecture, service search path). Only then address handshake/trust.
- Make the chain visible: s_client with „-showcerts“ from the affected network. Check: Are intermediates sent? Do Issuer/Subject match? Is the certificate valid in time? Does the hostname match (SAN/CN)?
- Define the trust model: Where does trust come from in the Indy/OpenSSL context? Define the CA bundle and the maintenance process (replacement, update, rollout) instead of „importing somewhere.“
- Isolate handshake issues: For method/protocol errors (e.g. EIdOSSLGetMethodError) check TLS versions/methods against OpenSSL version and server policy. Deliberately include or exclude proxy/inspection as a variable.
- Pinning only after stability: Only enable pinning once normal PKI verification runs cleanly. Then use roll-over (two pins) and log data that clearly show pin mismatches.
Verify error 19: „self-signed certificate in chain“ and the typical chain pitfalls
„Self-signed certificate in chain“ (commonly Verify error 19) means: the supplied chain contains a self-signed certificate that the client does not accept as a trusted anchor. Chain-verify guides list this as a typical failure mode: self-signed is not automatically „forbidden“, but it must be configured as a trust anchor — otherwise it remains untrusted.[Quelle]
Typical causes you can check specifically:
- A wrong intermediate is delivered (e.g. test PKI instead of production PKI).
- The server sends certificates that do not belong to the intended chain (Issuer/Subject do not match cleanly).
- The client „somehow“ trusts a certificate, but not in a controlled way (no clean trust anchor in the OpenSSL context).
Consequence: Treat chain (server provides) and trust (client trusts) as strictly separate. Mixing them often leads quickly to the dangerous workaround of „turning Verify off“ instead of a stable solution.
Truststore vs. CA-Bundle vs. Pinning: Decisions with admin consequences
For operations and administration it matters less whether an approach is „elegant“ and more how trust is updated, how errors are made reproducible and how rollouts work in heterogeneous environments.
- OS-Truststore: Centrally manageable via GPO/MDM, good for large fleets. It only helps if the TLS stack in use actually uses the OS store (not automatic for Indy/OpenSSL).
- App-specific CA-Bundle: Reproducible and independent of OS state. For this, CA rotation must be part of your release and patch process.
- Pinning: Strongest binding to the expected identity, but sensitive to certificate changes and often incompatible with TLS inspection.
For many bespoke enterprise software setups an app-specific CA-Bundle is the pragmatic default: it models an „own CA“ cleanly, stays within PKI logic and is manageable. Pinning should be a targeted additional measure for particularly critical calls — not the default for every interface.
Logging that actually helps: What belongs in support logs
„More logs“ don’t help if you still have to guess afterwards. What you need are data points that enable a decision: fix the server, add to the CA-Bundle, clarify the proxy path or adjust the TLS method.
- Target: Host, port, whether a hostname or IP is used (SNI and hostname validation depend on that).
- Network path: Proxy yes/no (type if possible), indication of SSL-Inspection.
- Runtime: 32/64-bit, whether OpenSSL libs were successfully loaded, which OpenSSL/Indy version is in the deployment (build info).
- Verify data: Verify code/message (e.g. 20/19), Subject/Issuer, validity period.
- Pinning (if active): expected pin identifier and the observed fingerprint/key-hash as a hash value (no certificate dump in the log).
That allows operations to react in a targeted way without someone having to „quickly“ remote into an IDE. And with HTTPS issues involving a private CA this is usually the difference between one day and one week.
Your next priority: What to do first
If you currently have such a ticket, a strict order of steps helps more than additional complexity:
- Priority 1: Stabilize the OpenSSL deployment (matching DLLs, correct architecture, reproducible delivery path). Without that, everything else is random.
- Priority 2: Make chain and trust clean (server provides intermediates; client has a clear trust anchor in the OpenSSL context, e.g. via a CA-Bundle). This is the basis for an „own CA“.
- Priority 3: Pinning only as planned hardening (roll-over with two pins, clarify proxy reality, logs for pin mismatches). Not the first reflex.
If you need support for architecture, trust decisions or a reliable debugging process: contact Net-Base.
Sources and further information
The technical core statements were editorially contextualized using the following external sources.
- ossl-guide-tls-introduction – OpenSSL Documentation (docs.openssl.org)
OpenSSL/TLS trust is based on a certificate chain up to a Trust Anchor; without a matching Trust Anchor the connection is not trustworthy. - Fix „unable to get local issuer certificate“ · CertGuru (certguru.io)
Verify error 20 „unable to get local issuer certificate“ indicates a missing local issuer certificate; diagnosis by inspecting the supplied chain is recommended. - OpenSSL changes – Indy (www.indyproject.org)
Indy can raise exceptions when an unavailable protocol method/version is selected in SSLOptions (OpenSSL changes). - Delphi – Indy TCP client-server don’t work with OpenSSL – Stack Overflow (stackoverflow.com)
Indy requires matching OpenSSL DLLs; if libraries are missing or incompatible, „Could not load SSL library“ occurs. - chromium/net/base/net_error_list.h at master · adobe/chromium · GitHub (github.com)
Pinning enforces host-specific acceptance of certificates/keys; a pin mismatch is a distinct connection error case. - SSL handshake failed: causes and how to diagnose it | HostTracker Guides (www.host-tracker.com)
Handshake failures can also result from protocol/cipher incompatibilities or interference by proxies/AV, not only from missing CA trust.
For this topic, Indy OpenSSL DLLs and a private CA truststore are also important. The article puts these aspects into context and explains what matters in day-to-day operations.
Discuss a project or modernization initiative with Net-Base.
Next step
When the topic becomes an actual project, architecture, existing systems and operations should be considered together from the outset.
We support not only with individual issues, but also when source snippets, legacy topics, or portal ideas are to be turned into a robust enterprise project.
- Current state, target state and technical risks are assessed jointly.
- REST, data access, portals and rollout are not deferred to a later stage as secondary consequences.
- You can see early on which path is economically and operationally viable.
Its Amazing
HI,I AM HERE AGAIN AND AGAIN