Open Charging Technology · Whitepapers

HTTP Basic Authentication with Time-Based One-Time Passwords

In the current OCPP protocol, communication between charging stations, local controllers and backends relies on the Authorization: Basic <login:password> HTTP header for authentication. This static parameters are initially configured during commissioning process and can later be updated using OCPP requests or Device Model updates. However, in practice, this authentication functions as a long-lived shared secret even when transmitted over a TLS-secured channel.

When public Root CAs are used for TLS, the risk of token leakage increases significantly due to potential certificate impersonation, compromised CA trust chains, or improper certificate validation within implementations. Once a static token is exposed, it provides full OCPP access until detected and changed manually.

To mitigate this security weakness, the password shall be replaced by a Time-Based One-Time Password (TOTP). This approach reduces backward incompatibilities with existing OCPP implementations while adding a dynamic verification layer resistant to replay and credential theft, as no static password is longer send over "the wire".

Prerequisites

Implementing TOTP-based two-factor authentication requires rough time synchronization between both communicating OCPP nodes. As TOTP validity depends on short-lived time slots (typically 30 s), even minor clock drift can lead to authentication failures.

To ensure reliable operation:

  1. Network Time Synchronization Each OCPP node must maintain its system clock via a trusted and authenticated time source, ideally using Network Time Secure (RFC 8915).

  2. Tolerance Policy The receiving system should accept TOTP values from the current time slot and its immediate predecessor/successor (± 1 slot), to compensate for minimal drift or network latency.

  3. Clock Drift Monitoring Implementations should continuously monitor time offset between peers and issue warnings if drift exceeds 10 seconds (ToDo).

  4. Shared Secret Management The TOTP shared secret is a critical element for both generating and validating one-time passwords. While TOTP itself prevents credential reuse or replay, the shared secret remains a long-term static secret that must be stored and protected with the same rigor as a static OCPP password.

  5. System Log Integrity Time synchronization must be part of the system’s overall security audit trail.

Design Concept

The token derivation and this Basic binding are normatively specified in Time-Based One-Time Passwords: OCPP's "TOTP algorithm, version 1" is the sha256/Base62 profile of the token format specification, and the Basic binding sketched above is section 4 of its HTTP authentication specification — machine-checkable via the test-vector annex and the TOTP conformance suite.

Compatibility and Migration

Security Benefits

Security Operations