Certificates: Static Chains and PKI Provisioning

A secured ITS station needs Authorization Tickets (ATs), pseudonymous certificates (ETSI TS 103 097) issued by an Authorization Authority (AA) under a Root CA. FlexStack can use a static chain generated locally, for laboratory tests, or obtain its ATs from a PKI with the ETSI TS 102 941 protocol.

Static Certificate Chains

Both repositories include a generator that writes a Root CA, an AA and two ATs, with the permissions of CAM (ITS-AID 36), DENM (37), VAM (638) and GeoNetworking management (141), into a certs/ folder.

Python

cd FlexStack
python examples/generate_certificate_chain.py   # writes examples/certs/: root_ca, aa, at1, at2 (.cert, .pem)

Rust

cd RustFlexstack
cargo run --example generate_certificate_chain  # writes certs/: root_ca, aa, at1, at2 (.cert, .key)

The .cert files are the certificates in canonical OER; the .pem / .key files hold the private keys. These keys are for testing only.

Inspecting a Chain with Python

from flexstack.security.certificate import Certificate

root_ca = Certificate().decode(open("certs/root_ca.cert", "rb").read(), issuer=None)
aa = Certificate().decode(open("certs/aa.cert", "rb").read(), issuer=root_ca)
at1 = Certificate().decode(open("certs/at1.cert", "rb").read(), issuer=aa)

print(f"Root CA HashedId8: {root_ca.as_hashedid8().hex()}")
print(f"AT1 HashedId8:     {at1.as_hashedid8().hex()}")

Passing the issuer to decode links each certificate to its issuer, which the verify service uses to check the chain. To use the chain in a station, see Python Security Subsystem and Rust Security Subsystem.

Provisioning from a PKI (ETSI TS 102 941)

The PKI clients of both implementations speak the official ETSI TS 102 941 V2.2.1 messages (Annex C HTTP binding) with an Enrolment Authority (EA) and an Authorization Authority (AA):

  1. Canonical key pair. The ITS-S has a canonical key pair and identifier, which the EA must know before the first enrolment (clause 6.1.2). The first run creates the pair, saves it (canonical_key.pem, with the public key in canonical_key.pub.pem), prints the command that registers it with the EA, and stops with exit status 2.

  2. Registration. The operator of the EA registers the canonical identifier and public key.

  3. Enrolment. The ITS-S requests an Enrolment Credential (EC) from the EA; the request is repeated while no response arrives (ETSI TS 103 601).

  4. Authorization. The ITS-S requests ATs from the AA with its EC; the AA validates the request with the EA.

The EC and the ATs are saved and reused on later runs. With the Rust command-line station:

# First run: creates the canonical key and prints the registration command
sudo v2x_cli -i eth0 --send cam --pki \
    --ea-url http://localhost:8080/ea/v1/enrolment \
    --aa-url http://localhost:8081/aa/v1/authorization

# After registering the ITS-S with the EA, the same command enrols,
# obtains an AT and sends CAMs signed with it

The Root CA, EA and AA certificates are read from the certificate directory (--certs-dir, default certs/). In Python, the same flow is examples/secured_cam_with_pki.py (see Python Security Subsystem).