How to Set Up HTTPS Client Certificate Authentication (mTLS) for Your AS2 Connection
·
Overview
You can set up HTTPS client certificate authentication (mutual TLS, or mTLS) on your AS2 connections yourself through the ECGridOS API. When it's on, ECGrid presents a client certificate to your trading partner's HTTPS endpoint during the TLS handshake, and the partner validates it before accepting the connection.
When you need this: your trading partner asks for ECGrid's "client authentication certificate" so they can trust or whitelist it. It's often used in place of HTTP Basic Authentication (user name and password).
This is not your AS2 certificate. Your AS2 signing/encryption certificate secures the message itself. The mTLS client certificate secures the connection. They are separate certificates on the same connection:
AS2 signing/encryption certificate | mTLS client certificate | |
|---|---|---|
Protects | The AS2 message (payload) | The HTTPS connection |
Partner uses it to | Verify signatures and encrypt data to you | Decide whether to accept the connection |
ECGridOS |
|
|
Before you start
You'll need:
- An active ECGridOS API session (
SessionID) with permission to manage the connection. - The
CommIDof the AS2 connection to your trading partner (or the details to create a new one). - If you'll use your own certificate: the certificate and private key as a .pfx or .p12 file, and its password.
Ask your trading partner these questions first. Their answers decide how you set things up:
- Will you accept a self-signed certificate, or must it be issued by a public certificate authority (CA)? Self-signed: let ECGridOS generate it (step 2, Option A). CA-issued: upload your own (step 2, Option B).
- Does the client certificate replace Basic Authentication, or do you need both?
- What format do you want the public certificate in (PEM or DER), and do you need the full chain?
Steps
- Turn on client certificate authentication for the connection.
- New connection: call
CommAddAwithSSLClientAuthentication = true. - Existing connection: call
CommUpdateAwith yourCommIDandSSLClientAuthentication = true. Re-send the connection's current values for the other fields so they don't change. - If the certificate replaces Basic Authentication, set
HTTPAuthentication = Noneand leaveHTTPUserandHTTPPasswordempty.
- New connection: call
- Add the client certificate to the same
CommID.Choose one option:- Option A, ECGridOS generates a self-signed certificate: call
CertificateCreatePrivatewithUsage = SSL,SecureHashAlgorithm = sha2, aBeginUsagedate and anExpiresdate. - Option B, upload your own certificate (for example, CA-issued): call
CertAddPrivateAwithCertType = X509,Usage = SSL,CertBase64= your .pfx or .p12 file encoded as Base64, andPassword= the file's password.
- Option A, ECGridOS generates a self-signed certificate: call
- Get the public certificate and send it to your partner.
- Both calls return the connection's
Certificateslist. Find the entry whereUsageisSSL. - Check that
HasPrivateKeyistrueand thatThumbprint,NotBeforeandNotAfterare what you expect. - Copy its
PublicCertificatevalue (Base64). To make a PEM file, put it between-----BEGIN CERTIFICATE-----and-----END CERTIFICATE-----lines and save it as a .cer or .pem file. - Send your partner the public certificate only. Never send the private key or the .pfx file.
- Both calls return the connection's
- Test. After your partner confirms they've trusted the certificate, send a test file. A successful delivery and MDN confirm the TLS handshake works.
- Plan for renewal. Note the
NotAfterdate. At least 30 days before it, add a new certificate (step 2) and send your partner the new public certificate, so they can trust both during the changeover.
Sample requests
SOAP 1.1 bodies for the ECGridOS v4.1 endpoint https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx. Replace the values in brackets.
Step 1: enable client certificate authentication on an existing connection (SOAPAction: "https://os.ecgrid.io/CommUpdateA")
Step 2, Option A: generate a self-signed client certificate (SOAPAction: "https://os.ecgrid.io/CertificateCreatePrivate")
Step 2, Option B: upload your own client certificate (SOAPAction: "https://os.ecgrid.io/CertAddPrivateA")
Full definitions for every operation are in the ECGridOS API v4.1 reference.
Troubleshooting and FAQ
Symptom | Likely cause | Fix |
|---|---|---|
Partner's server rejects the TLS handshake |
| Re-run step 1 and check the response shows |
Partner's server rejects the TLS handshake | Partner trusted a different certificate | Compare the |
Partner rejects a self-signed certificate | Partner requires a CA-issued certificate | Use step 2, Option B with a CA-issued certificate |
Partner reports an incomplete chain | Intermediate or root certificate missing | Send the intermediate and root certificates along with your public certificate |
| Wrong password, or the file isn't Base64-encoded | Check the .pfx password and re-encode the file as Base64 |
Connection worked, now fails | Certificate expired or outside its usage dates | Check |
Can I use my AS2 signing certificate for mTLS? Use a separate certificate with Usage = SSL. That way you can renew or replace one without affecting the other.
Do I need Basic Authentication too? Only if your partner asks for both. Most partners use the client certificate in place of Basic Authentication.
Still stuck? Contact support@ecgrid.com with your CommID and the error your partner sees.
Related articles
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article