Skip to content

IEC 104 TLS (IEC 62351-3)

An IEC 104 link can be encrypted with TLS. The profile is IEC 62351-3:2023: both ends present a certificate, each checks the other’s against the CA it trusts, keys are renewed at set intervals, and revoked certificates are refused. TLS is turned on with the same fields on a Client and on a Server connection.

With TLS off the link is plain TCP and nothing about it changes. IEC 104 itself (ASDUs, t1–t3, k/w, general interrogation, commands, the event buffer) does not change with TLS either; TLS is a layer below it.

For each end:

  • Its own certificate and private key, as a PKCS#12 file (.p12 / .pfx), and its password.
  • The certificate of the CA that issues the peer’s certificate, PEM or DER. Only a peer presenting a certificate from this CA is accepted.
  • Optionally a CRL (revocation list), PEM or DER.

Keys must be at least RSA 2048 or a 256-bit curve (e.g. P-256); certificates are accepted up to 8192 bytes.

The fields belong to the connection and are the same for Client and Server. The files are uploaded with the connection: the TLS (IEC 62351-3) section of the connection form, or over REST POST /api/protocols/iec104/connections/with-file and PUT /api/protocols/iec104/connections/{id}/with-file (a multipart request: connection plus the parts tlsCertificateFile, tlsCaFile, tlsCrlFile).

FieldTypeDefaultDescription
tlsEnabledBooleanoffTurns TLS on
tlsMinVersionTLS 1.2 / TLS 1.3TLS 1.2The lowest version. With TLS 1.2, TLS 1.3 is offered as well; TLS 1.3 speaks 1.3 only. TLS 1.0 / 1.1 are never offered
tlsCertificateFileIdFile—The connection’s own certificate and key (PKCS#12)
tlsCertificatePasswordSecret—The PKCS#12 password; never shown in any response
tlsCaFileIdFile—The trusted CA certificates
tlsCrlFileIdFile—Revocation list (optional)
tlsTrustModeAny from CA / Listed from CAAny from CAWhich peers are accepted; see Allowed peers below
tlsResumptionMinutesInteger360TLS 1.2: session resumption interval (new keys, no certificate check). Must be below the renegotiation interval
tlsRenegotiationMinutesInteger720TLS 1.2: full renegotiation interval; both certificates are checked again. 10 to 1440 minutes
tlsKeyUpdateMinutesInteger0 (off)TLS 1.3: key update interval. See the warning below
tlsRenegotiationTimeoutMsInteger10000How long a renegotiation may take
tlsRevocationCheckMinutesInteger1440How often open links are checked against the CRL again
tlsRevocationGraceHoursInteger0How long a peer whose certificate was revoked may stay connected; 0 = closed at once

A peer is refused and the link is not established when:

  • it sent no certificate (a server always asks for the client’s certificate);
  • its certificate does not chain to the trusted CA;
  • its certificate has expired or is not yet valid;
  • its chain holds a weak key or a certificate larger than 8192 bytes;
  • in Listed from CA, its certificate is not approved in the connection’s trust list;
  • the CRL lists the certificate as revoked.

A CRL that is missing, expired or not signed by the CA does not close the link; a warning is written (IEC 62351-3 6.4.4.4.2). A certificate an expired CRL lists is still treated as revoked.

The host name is not verified: field links are addressed by IP, and the peer’s identity is its certificate.

With tlsTrustMode set to Listed from CA, a peer that passes the CA check must also be approved in the connection’s trust list (IEC 62351-3 6.4.4.3). The list is the same certificate trust list OPC UA connections use. A peer is recognised by its certificate’s serial number and issuing CA.

  • A peer the CA issued but that is not on the list is refused (PEER_NOT_ALLOWED) and added to the list as pending. The project log writes “waiting for approval”.
  • In the connection form, the Trusted Peers window next to the Trust Mode field approves a pending certificate, or takes a certificate file directly. The window opens on a saved connection.
  • The list is read every 15 seconds. An approval takes effect at the peer’s next attempt, without restarting the connection. A peer removed from the list has its open link closed.
  • When the list cannot be read, the connection does not start; it never falls back to accepting every peer the CA issued.

REST: GET /api/protocols/iec104/connections/{id}/certificates/trusted and …/pending, POST …/certificates/{entry}/trust, POST …/certificates/upload-trusted (multipart, certificateFile), DELETE …/certificates/{entry}.

A CA usually publishes a new CRL every few days. Instead of uploading it to every connection, use the space’s CRL store:

  • TLS connections add the CAs they trust to the store by themselves when they start.
  • In the connection form’s TLS section, CRL Store → CAs and CRLs uploads a CRL for each CA, or sets its download address, on/off and period. Download now tries at once; the last download’s time and error show on the row.
  • An empty address is filled from the CRL distribution point in a connecting peer’s certificate. Downloading starts when you turn it on.
  • A CRL is taken only when the CA signed it, it has not expired and it is not older than the one in use; otherwise the reason is written and the CRL in use stays.
  • Connections read the store every minute. A new CRL applies without restarting the connection, and the open links are checked against it at once; a revoked peer is closed.
  • The connection’s own CRL file still applies; for one CA the newest CRL is used.

Downloads use http / https only; they never go to the server itself, a link-local address (e.g. 169.254.x.x) or a multicast address, and redirects are not followed. Connect 10 s, request 30 s, at most 10 MB. In a cluster the leader downloads.

REST: GET /api/connections/certificate-authorities, POST …/{id}/crl (multipart, crlFile), PUT …/{id}/download (url, downloadEnabled, downloadMinutes), POST …/{id}/download (download now), DELETE …/{id}.

VersionMechanismWhat happens
TLS 1.2Session resumption (tlsResumptionMinutes)The client takes new session keys; the certificates are not checked again
TLS 1.2Full renegotiation (tlsRenegotiationMinutes)The server asks for a renegotiation; the client starts one itself shortly after the interval if it has not been asked. Both certificates are checked again. A renegotiation that does not complete in time closes the link
TLS 1.3Key update (tlsKeyUpdateMinutes)New traffic keys; the certificates are not checked again

Because TLS 1.3 never looks at a certificate again after the handshake, revocation is checked by the application every tlsRevocationCheckMinutes: the peer certificate of each open link is checked against the CRL again, and a revoked peer’s link is closed (at the end of the grace period, if one is set).

On a server, the event buffer of a TLS client belongs to the client’s certificate (its subject and issuing CA, e.g. CN=Central SCADA (issued by CN=Plant CA)), not to its IP address. So:

  • a client whose IP address changes still gets the events kept for it;
  • clients behind the same NAT are not mixed up;
  • a client whose certificate is renewed (same subject and CA) keeps its buffer.

The Event buffer and Clients windows of the control panel show this key.

TLS events are written to the connection’s project log. Each line carries the event and the IEC 62351-3 clause it comes from, e.g. … [IEC 62351-3 6.4.4.2, PEER_CERTIFICATE_UNTRUSTED].

EventLog levelWhen
HANDSHAKE_SUCCEEDEDInformationThe link is up; the version, cipher suite and peer certificate are written
HANDSHAKE_FAILEDErrorThe handshake failed (no common version / cipher suite, timeout, an alert from the peer)
PEER_CERTIFICATE_MISSINGErrorThe peer sent no certificate
PEER_CERTIFICATE_UNTRUSTEDErrorThe peer’s certificate does not chain to the trusted CA
PEER_CERTIFICATE_EXPIRED / _NOT_YET_VALIDErrorOutside the certificate’s validity (check both clocks)
PEER_KEY_TOO_WEAK / PEER_CERTIFICATE_TOO_LARGEErrorWeak key / certificate larger than 8192 bytes
PEER_CERTIFICATE_REVOKEDErrorThe CRL revokes the certificate; the link is refused or closed
PEER_REVOKED_IN_GRACEWarningThe certificate was revoked; the link stays up for the grace period
CRL_UNAVAILABLE / CRL_EXPIRED / CRL_INVALIDWarningNo CRL, an expired one, or one with an invalid signature; the link is not closed
SESSION_RESUMEDInformationTLS 1.2 session resumption
RENEGOTIATEDInformationTLS 1.2 full renegotiation; both certificates were checked again
RENEGOTIATION_FAILEDErrorThe renegotiation did not complete; the link was closed
KEY_UPDATEDInformationA TLS 1.3 key update was sent
SESSION_FAILEDErrorA TLS layer failure on an open link

On a client connection, a refused handshake is also written as “Could not connect to the station over TLS”: the link was never established, it is not a loss.

Supported: TLS 1.2 and 1.3, mutual authentication, AES-GCM cipher suites (ECDHE-ECDSA, ECDHE-RSA, DHE-RSA; 128 and 256 bit), TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 for TLS 1.3, groups including secp256r1 and ffdhe2048, signature schemes without SHA-1, secure renegotiation (RFC 5746), session resumption, full renegotiation, key update, revocation by CRL with a grace period.

Not supported:

In the standardStatus
CBC cipher suites, including the mandatory TLS_RSA_WITH_AES_128_CBC_SHA256Not offered. CBC must be used with Encrypt-then-MAC (RFC 7366), which the TLS stack in use does not provide; offering CBC without it makes a conforming peer close the link. Older devices that only know RSA key exchange cannot connect
TLS 1.3 TLS_AES_128_CCM_SHA256Not supported. The mandatory GCM suites are offered, so a conforming peer always finds a common suite
OCSP stapling for a client certificate in TLS 1.3Not supported; revocation is by CRL