Rust Security Subsystem

The rustflexstack::security module implements ETSI TS 103 097 V2.2.1 on the IEEE 1609.2 data structures, and a PKI client for ETSI TS 102 941 V2.2.1 and TS 103 601 V2.1.1.

Key Components

Struct

Description

EcdsaBackend

ECDSA signing and verification with the RustCrypto p256, p384, bp256 and bp384 crates; holds the private keys.

Certificate / OwnCertificate

A decoded certificate with its issuer; an OwnCertificate also refers to a private key in the backend.

CertificateLibrary

The trust store: Root CAs, Authorization Authorities and known Authorization Tickets.

SignService

Selects an AT whose ITS-AID, SSP, validity and region permit the message, signs it, and switches between the AT digest and the full AT.

verify_service

Verification of the signature, the chain (AT, AA, Root CA), the permissions and the generation time and location.

PkiClient

Enrolment and authorization with the EA and AA, CTL and CRL retrieval.

Building the Sign Service from a Static Chain

The chain is written by cargo run --example generate_certificate_chain into certs/ (see Certificates: Static Chains and PKI Provisioning):

use std::fs;
use rustflexstack::security::certificate::{Certificate, OwnCertificate};
use rustflexstack::security::certificate_library::CertificateLibrary;
use rustflexstack::security::ecdsa_backend::EcdsaBackend;
use rustflexstack::security::sign_service::SignService;

let root_ca = Certificate::from_bytes(&fs::read("certs/root_ca.cert").unwrap(), None);
let aa = Certificate::from_bytes(&fs::read("certs/aa.cert").unwrap(), Some(root_ca.clone()));
let at1 = Certificate::from_bytes(&fs::read("certs/at1.cert").unwrap(), Some(aa.clone()));

let mut backend = EcdsaBackend::new();
let key_id = backend.import_signing_key(&fs::read("certs/at1.key").unwrap());

let cert_library = CertificateLibrary::new(&backend, vec![root_ca], vec![aa], vec![at1.clone()]);
let mut sign_service = SignService::new(backend, cert_library);
sign_service.add_own_certificate(OwnCertificate::new(at1, key_id));

The sign service, and a backend and certificate library for verification, are given to the GeoNetworking router with GNRouter::spawn(mib, Some(sign_service), Some(verify_backend), Some(verify_library)), with mib.itsGnSecurity = GnSecurity::Enabled. examples/v2x_cli.rs (--security) shows a complete secured station, in which signing and verification run in middleware threads between the router and the link layer.

Obtaining ATs from a PKI

PkiClient speaks the official TS 102 941 V2.2.1 messages. The station’s canonical key pair is created with load_or_create_canonical_key and must be registered with the EA before the first enrolment; the client then enrols with the EA, obtains ATs from the AA, repeats unanswered enrolment requests (TS 103 601) and keeps the EC and ATs on disk. v2x_cli --pki runs this flow (see Certificates: Static Chains and PKI Provisioning). Butterfly key expansion is not implemented.