CertificateTrust¶
Overview¶
TLS trust of one device. The framework adds it to every connection Thing of an adapter with transport.tls: true. The adapter writes no code for it.
| Device certificate | What happens |
|---|---|
| Signed by a trusted authority and matching the address | The connection passes. Nothing is stored, so the device may renew the certificate. |
| Fails the standard validation (self-signed, unknown authority, name mismatch, expired), first connection | The SHA-256 thumbprint is stored. Event pq.event.connection.certificate.trusted without personId. |
| Same thumbprint | The connection passes, and an earlier refusal stops waiting for the operator. |
| Different thumbprint | The connection is refused. Event pq.event.connection.certificate.rejected with thumbprint and expected, once per refused thumbprint. The AuthenticatedProtocol slot shows protocol.handshake.failed. |
The command pq.command.connection.certificate.trust trusts the thumbprint the device presented at the refusal, never a later one. It publishes pq.event.connection.certificate.trusted with the operator in personId. The next connection attempt passes. Without a refused certificate the command fails.
The stored thumbprint survives a restart of the adapter.
- Namespace:
Pq.Adapters.Framework
When to Use¶
Set transport.tls: true when the device offers TLS: an https:// address on an http transport, or TcpConnectionOptions.UseTls on a tcp transport. See Transport types — TLS.
States¶
None. A refused certificate shows in the AuthenticatedProtocol slot.
Properties¶
| Property | Type | Description |
|---|---|---|
tls_client_certificate |
string, sensitive | Client certificate the device requires, as a PFX file in base64. Empty when the device asks for none. |
tls_client_certificate_password |
string, sensitive | Password of the PFX. |
A value that is not a base64 PFX the password opens fails the connection with a message naming the property.
Commands¶
| Command | Runner |
|---|---|
pq.command.connection.certificate.trust |
ConnectionCommandRunner.Trust |
Events¶
| Event | Parameters |
|---|---|
pq.event.connection.certificate.trusted |
thumbprint, personId (operator; empty on the first connection) |
pq.event.connection.certificate.rejected |
thumbprint (presented), expected (trusted) |