This content is for SDK V4. For the latest version, see the V5 documentation.
This section contains an advanced discussion of Ditto’s underlying certificate, identity, and encryption implementation. Most readers can skip this section. However, if you are deploying an enterprise on-premises deployment of Ditto, you may be required to reference the following material.
Identities
An identity is a bundle of the device and app-specific information:Certificates
Ditto identities and public keys are distributed in the standard X.509 certificate format. They do not directly contain potentially sensitive data such as access rules, but these can be defined by the app’s authentication webhook with the OnlineWithAuthentication identity, or by the developer through theManual identity.
When you are ready to use production identities, feel free to contact us through the Ditto Portal and we will help you set up the right CA tooling for your use case - or provide specifications so you can build your own.
Discovering peers
Devices need to have the same AppID to discover other peers on the network, as well as matching certificates to connect over TLS 1.3. Peer-to-peer connections use mTLS (client certificates) with TLS 1.3. Connections to Ditto Server use a TLS-secured WebSocket connection, with authentication by JWT. Once the certificates match, then the embedded authorization information inside each certificate is used to authorize any incoming requests by that peer. This ensures that those access control rules are enforced.Syncing with Ditto Server
This covers internal details of the Ditto Server implementation. Ditto’s authentication module handles it for you under the hood as part of the
OnlineWithAuthentication and OnlinePlayground identities.Rationale
Why does X.509 return both a key and a certificate instead of locally generating a key and sending a CSR? It would be possible to use a standard CSR flow. It was chosen to issue keys directly for a few reasons.- There is no security benefit as our certificate request is in a secured tunnel, and the identity service is presumed to be completely trustworthy.
- Validating and signing CSRs is more complex than simply creating one with the correct format and fields.
- This is a convenient workflow if using Hashicorp Vault or similar to manage your PKI and issue certificates on demand.