-
-
Notifications
You must be signed in to change notification settings - Fork 443
OCPP 1.6J Security Configuration
This document describes how to configure SteVe to support the three OCPP 1.6 security profiles defined in the OCPP 1.6 Security Whitepaper Edition 3.
- Transport: HTTP or WebSocket (ws://)
- Authentication: HTTP Basic Authentication
- Encryption: None
- Use Case: Development, testing, closed networks
- Transport: HTTP or WebSocket (ws://)
- Authentication: HTTP Basic Authentication + Charge Point Password
- Encryption: None
- Use Case: Private networks with additional authentication layer
- Transport: HTTPS or Secure WebSocket (wss://)
- Authentication: HTTP Basic Authentication + TLS Server Certificate
- Encryption: TLS 1.2 or higher
- Use Case: Production environments with server authentication
- Transport: HTTPS or Secure WebSocket (wss://)
- Authentication: Mutual TLS (mTLS) with client certificates
- Encryption: TLS 1.2 or higher
- Use Case: High-security production environments
Add these properties to application-prod.properties or application-test.properties:
# OCPP Security Profile (0, 1, 2, or 3)
ocpp.security.profile=2
# TLS Configuration (required for Profile 2 and 3)
ocpp.security.tls.enabled=true
# Server Keystore (contains server certificate and private key)
ocpp.security.tls.keystore.path=/path/to/server-keystore.jks
ocpp.security.tls.keystore.password=your-keystore-password
ocpp.security.tls.keystore.type=JKS
# Truststore (contains trusted CA certificates)
ocpp.security.tls.truststore.path=/path/to/truststore.jks
ocpp.security.tls.truststore.password=your-truststore-password
ocpp.security.tls.truststore.type=JKS
# Client Certificate Authentication (required for Profile 3)
ocpp.security.tls.client.auth=false
# TLS Protocol Versions (comma-separated)
ocpp.security.tls.protocols=TLSv1.2,TLSv1.3
# TLS Cipher Suites (optional, leave empty for defaults)
ocpp.security.tls.ciphers=ocpp.security.profile=0
ocpp.security.tls.enabled=false
# Use HTTP Basic Auth credentials
auth.user=admin
auth.password=your-passwordWebSocket URL: ws://your-server:8080/steve/websocket/CentralSystemService/{chargePointId}
ocpp.security.profile=1
ocpp.security.tls.enabled=false
# Configure charge point authorization keys in database
# Each charge point should have an authorization_key setWebSocket URL: ws://your-server:8080/steve/websocket/CentralSystemService/{chargePointId}
Database: Set authorization_key column in charge_box table for each charge point.
✅ RECOMMENDED FOR PRODUCTION
# Create server keystore with self-signed certificate (for testing)
keytool -genkeypair -alias steve-server \
-keyalg RSA -keysize 2048 -validity 365 \
-keystore server-keystore.jks \
-storepass changeit \
-dname "CN=steve.example.com, OU=SteVe, O=Example, L=City, ST=State, C=US"
# OR: Import existing certificate and private key
# (Use openssl to convert PEM to PKCS12, then import to JKS)ocpp.security.profile=2
ocpp.security.tls.enabled=true
# Server certificate
ocpp.security.tls.keystore.path=/opt/steve/certs/server-keystore.jks
ocpp.security.tls.keystore.password=changeit
ocpp.security.tls.keystore.type=JKS
# Enable HTTPS on Jetty
https.enabled=true
https.port=8443
keystore.path=/opt/steve/certs/server-keystore.jks
keystore.password=changeit
# Client authentication NOT required for Profile 2
ocpp.security.tls.client.auth=falseWebSocket URL: wss://steve.example.com:8443/steve/websocket/CentralSystemService/{chargePointId}
Certificate: Charge points must trust the server certificate. Install the CA certificate or server certificate on charge points.
✅ RECOMMENDED FOR HIGH-SECURITY ENVIRONMENTS
# Create CA private key and certificate
openssl genrsa -out ca-key.pem 4096
openssl req -new -x509 -days 3650 -key ca-key.pem -out ca-cert.pem \
-subj "/CN=SteVe CA/O=Example/C=US"# Generate server private key and CSR
openssl genrsa -out server-key.pem 2048
openssl req -new -key server-key.pem -out server.csr \
-subj "/CN=steve.example.com/O=Example/C=US"
# Sign server certificate with CA
openssl x509 -req -in server.csr -CA ca-cert.pem -CAkey ca-key.pem \
-CAcreateserial -out server-cert.pem -days 365
# Convert to PKCS12
openssl pkcs12 -export -in server-cert.pem -inkey server-key.pem \
-out server.p12 -name steve-server -passout pass:changeit
# Import to JKS keystore
keytool -importkeystore -srckeystore server.p12 -srcstoretype PKCS12 \
-destkeystore server-keystore.jks -deststoretype JKS \
-srcstorepass changeit -deststorepass changeit# Import CA certificate to truststore
keytool -import -trustcacerts -alias ca-cert \
-file ca-cert.pem -keystore truststore.jks \
-storepass changeit -noprompt# Generate client private key and CSR
openssl genrsa -out client-cp001-key.pem 2048
openssl req -new -key client-cp001-key.pem -out client-cp001.csr \
-subj "/CN=CP001/O=Example/C=US"
# Sign client certificate with CA
openssl x509 -req -in client-cp001.csr -CA ca-cert.pem -CAkey ca-key.pem \
-CAcreateserial -out client-cp001-cert.pem -days 365
# Convert to PKCS12 for charge point
openssl pkcs12 -export -in client-cp001-cert.pem -inkey client-cp001-key.pem \
-out client-cp001.p12 -name cp001 -passout pass:changeitocpp.security.profile=3
ocpp.security.tls.enabled=true
# Server certificate
ocpp.security.tls.keystore.path=/opt/steve/certs/server-keystore.jks
ocpp.security.tls.keystore.password=changeit
ocpp.security.tls.keystore.type=JKS
# Truststore with CA certificate (to verify client certificates)
ocpp.security.tls.truststore.path=/opt/steve/certs/truststore.jks
ocpp.security.tls.truststore.password=changeit
ocpp.security.tls.truststore.type=JKS
# Require client certificates
ocpp.security.tls.client.auth=true
# TLS protocols
ocpp.security.tls.protocols=TLSv1.2,TLSv1.3
# Enable HTTPS
https.enabled=true
https.port=8443
keystore.path=/opt/steve/certs/server-keystore.jks
keystore.password=changeit- Transfer
client-cp001.p12to charge point CP001 - Configure charge point to use client certificate for mTLS
- Configure charge point with CA certificate to verify server
- Set WebSocket URL:
wss://steve.example.com:8443/steve/websocket/CentralSystemService/CP001
- Use a proper CA: For production, use certificates from a trusted CA (Let's Encrypt, DigiCert, etc.)
- Certificate rotation: Renew certificates before expiry
- Revocation: Implement CRL or OCSP for certificate revocation
- Key length: Use at least 2048-bit RSA keys or 256-bit ECC keys
- Storage: Protect private keys with strong passwords and secure storage
- Protocol versions: Use TLS 1.2 or higher, disable SSLv3 and TLS 1.0/1.1
- Cipher suites: Use strong ciphers (AES-GCM, ChaCha20-Poly1305)
- Perfect Forward Secrecy: Prefer ECDHE or DHE cipher suites
- HSTS: Enable HTTP Strict Transport Security
ocpp.security.tls.ciphers=\
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,\
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,\
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256The charge_box table includes security-related columns:
-- Security profile for this charge point (0-3)
ALTER TABLE charge_box ADD COLUMN security_profile INT DEFAULT 0;
-- Authorization key for Profile 1+ (optional)
ALTER TABLE charge_box ADD COLUMN authorization_key VARCHAR(100);
-- CPO name (for certificate validation)
ALTER TABLE charge_box ADD COLUMN cpo_name VARCHAR(255);
-- Certificate store max length
ALTER TABLE charge_box ADD COLUMN certificate_store_max_length INT;
-- Additional root certificate check
ALTER TABLE charge_box ADD COLUMN additional_root_certificate_check BOOLEAN DEFAULT FALSE;- Check: Certificate validity (not expired)
- Check: Hostname matches CN in server certificate
- Check: Charge point trusts the server certificate or CA
- Check: Client certificate signed by trusted CA in truststore
- Check: Client certificate not expired
-
Check:
ocpp.security.tls.client.auth=trueis set
- Check: Both server and charge point support same TLS version
-
Check:
ocpp.security.tls.protocolsincludes supported versions
- Check: CN in certificate matches charge point ID or hostname
- Check: Certificate chain is complete
- Check: CA certificate imported to truststore
# Test TLS connection
openssl s_client -connect steve.example.com:8443 -showcerts
# Test with client certificate
openssl s_client -connect steve.example.com:8443 \
-cert client-cp001-cert.pem -key client-cp001-key.pem# Install wscat: npm install -g wscat
# Test Profile 2 (wss://)
wscat -c "wss://steve.example.com:8443/steve/websocket/CentralSystemService/CP001"
# Test Profile 3 (wss:// with client cert)
wscat -c "wss://steve.example.com:8443/steve/websocket/CentralSystemService/CP001" \
--cert client-cp001.p12 --passphrase changeit