Plug & Charge is hard to test because it needs three things that rarely sit on the same desk: a car with a contract certificate, a charger provisioned for ISO 15118, and a CSMS that knows what to do with both. Most CSMS teams get their first real Plug & Charge session at a pilot site, and find their bugs there.

You don’t need the car or the charger to test the CSMS’s part. Plug & Charge splits cleanly in two: the car and the charger talk ISO 15118, and the charger and the CSMS talk OCPP. This guide covers the OCPP half in OCPP 2.0.1 and 2.1: provisioning the charger, the Authorize that carries the contract, the answers your CSMS owes, and a test matrix you can run in Rey, the free browser-based virtual charge point. The big picture of Plug & Charge itself is in what ISO 15118 is.

What the CSMS has to get right

Four jobs, in the order a session needs them:

  1. Provision the charger with a V2G root and its own V2G certificate, so a car will open TLS to it.
  2. Keep the charger’s OCSP answers fresh, so a car that checks revocation during TLS gets a current answer.
  3. Authorize contracts: check the eMAID and the contract certificate chain, and say which one failed.
  4. Answer the bad cases precisely: revoked, expired, unknown PKI, cancelled contract.

The first two happen long before any car arrives. The last two happen while a driver waits.

Provisioning the charger

The charger proves itself to the car with a V2G certificate (the SECC certificate) that chains up to a V2G root the car trusts. The CSMS sets this up in two steps.

Install the root. InstallCertificate with certificateType V2GRootCertificate. Optionally also an MORootCertificate, which lets the charger check contract chains itself.

Get the charger a certificate. The CSMS sends TriggerMessage with requestedMessage SignV2GCertificate. The charger makes a key pair, keeps the private key, and sends a CSR:

[2, "sc-1", "SignCertificate", {
  "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIBN...\n-----END CERTIFICATE REQUEST-----\n",
  "certificateType": "V2GCertificate"
}]

The CSR’s subject names the charger. An ISO 15118-2 PKI expects the SECC ID in the common name (CN), and the SECC ID is the charger’s full EVSE ID, such as DE*REY*E000001. An ISO 15118-20 PKI issues its own SECC ID. The rest of the subject is the country (C), the organization (O) and a domain component: DC=CPO for an ISO 15118-2 certificate, DC=CSO (charging station operator) for an ISO 15118-20 one.

The CSMS answers Accepted, has the CSR signed by its CPO sub-CA, and sends the chain back:

[2, "cs-1", "CertificateSigned", {
  "certificateChain": "-----BEGIN CERTIFICATE-----\n...leaf...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n...CPO Sub-CA 2...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n...CPO Sub-CA 1...\n-----END CERTIFICATE-----\n",
  "certificateType": "V2GCertificate"
}]

The chain starts with the leaf and leaves out the root. The charger checks that the certificate matches the key behind its CSR, and answers Rejected if it doesn’t.

Key types. ISO 15118-2 uses ECDSA on the P-256 curve. ISO 15118-20 uses P-521 or Ed448. A charger that serves both kinds of car holds a V2G certificate for each key type, so your CSMS may have to sign more than one CSR. Which edition you can use depends on the OCPP version. OCPP 2.0.1 covers ISO 15118-2 only, and so does the OCA application note for 1.6, which follows 2.0.1. ISO 15118-20 arrives with OCPP 2.1, which gives its certificate its own names: certificateType V2G20Certificate and the trigger SignV2G20Certificate.

Once the certificate is in, the charger fetches OCSP responses for it with GetCertificateStatus. That is its own topic: see GetCertificateStatus and OCSP (coming soon).

Authorize with a contract

When the car presents its contract, the charger checks the car’s signature, optionally checks the chain against its own roots, and asks the CSMS:

[2, "au-1", "Authorize", {
  "idToken": { "idToken": "DE-REY-CVALID001-1", "type": "eMAID" },
  "iso15118CertificateHashData": [
    { "hashAlgorithm": "SHA256", "issuerNameHash": "c41f...", "issuerKeyHash": "7e02...",
      "serialNumber": "1b7d55", "responderURL": "http://ocsp.example.invalid/mo2" }
  ]
}]

The hashes are shortened. iso15118CertificateHashData holds up to four entries of OCSP request data, one per certificate in the contract chain, so the CSMS can ask the MO’s OCSP responder about each. When the charger couldn’t check the chain itself because it lacks the root, and CentralContractValidationAllowed is true, it also sends the chain in certificate (PEM, up to 5500 characters in OCPP 2.0.1 and 10000 in 2.1) so the CSMS can check it.

The answer carries two verdicts:

[3, "au-1", {
  "idTokenInfo": { "status": "Invalid" },
  "certificateStatus": "CertificateRevoked"
}]

idTokenInfo.status is about the eMAID. certificateStatus is about the chain. The OCPP 2.1 text spells out how they combine (C07.FR.13 to C07.FR.17), and it is a sensible target on 2.0.1 too:

What the CSMS foundcertificateStatusidTokenInfo.status
Valid chain, eMAID acceptedAcceptedAccepted
Valid chain, eMAID Blocked, Expired, Invalid or UnknownContractCancelledthat status
Valid chain, eMAID refused for another reason (for example ConcurrentTx)Acceptedthat status
Chain expiredCertificateExpiredExpired
Chain revokedCertificateRevokedInvalid
Chain can’t be verified or is invalidCertChainErrorInvalid

The charger turns certificateStatus into the ISO 15118 answer to the car, and a good charger into a useful line on its screen. A CSMS that returns only idTokenInfo leaves the driver with “not accepted” and support with nothing to go on. The message itself, in both versions, is in the Authorize guide (coming soon).

The test matrix

Run each case and check both fields of your CSMS’s answer, not just whether charging started.

CaseWhat the charger sendsWhat your CSMS should answer
ProvisioningSignCertificate with a CSRCertificateSigned with a leaf whose subject is what your PKI expects
Valid contracteMAID + hash dataAccepted / Accepted
Revoked contracteMAID + hash dataCertificateRevoked, Invalid
Expired contracteMAID + hash dataCertificateExpired, Expired
Contract from a PKI you don’t trusteMAID + hash data (+ chain)CertChainError, Invalid
Valid contract, blocked eMAIDeMAID + hash dataContractCancelled, Blocked
Charger without a rooteMAID + hash data + certificateA verdict from the chain itself
eMAID only, no certificateseMAIDAn idTokenInfo on the token alone
eMAID on the local listnothingYou see no Authorize at all

Try it in Rey

Rey runs the OCPP half of Plug & Charge with real certificates, on 2.0.1 and 2.1 directly and on 1.6 inside DataTransfer (coming soon). The car-to-charger side runs inside Rey too, with the real certificates and keys: the virtual car and the charger exchange real ISO 15118 messages, coded in EXI, over a real connection, and each exchange is one plain-language line in the log. The car signs its authorization request with its contract key, and the charger checks the signature. When the car plugs in, it and the charger agree on a protocol as on a real connection: SDP, then the TLS version, which decides the edition, then a real TLS handshake between the virtual car and the charger, and inside it SupportedAppProtocol. The handshake offers only what the edition allows: TLS 1.2 for ISO 15118-2, where only the charger presents a certificate, and TLS 1.3 with mutual authentication for ISO 15118-20. The log shows what was negotiated and each side’s verdict on the other’s certificates. The car carries one contract per edition and presents the one for the edition agreed, so a car that speaks both editions falls back to ISO 15118-2 at a charger that has only a -2 certificate.

The Rey handbook has pictures of every step below, and this video runs steps 1 to 4 on OCPP 2.0.1 with the valid and the revoked contract:

ISO 15118-2 Plug & Charge on OCPP 2.0.1 in Rey: a valid contract starts the session, a revoked one is refused with REY-PNC-001. Watch on YouTube ↗

With the Demo CSMS. Choose OCPP 2.0.1, keep Demo CSMS and press Connect.

  1. Open EV & contracts in the side rail and press Load demo certificates. You get a valid, a revoked and an expired contract for ISO 15118-2 (EC P-256) and the same three for ISO 15118-20 (EC P-521 and Ed448), each with its MO sub-CAs and private key, plus the V2G root the car trusts. Rey picks a valid contract for each edition, and the switch at the top of the dialog shows what each edition needs. On 2.0.1 the charger gets only an ISO 15118-2 certificate by default, so the car, which speaks both editions, falls back to ISO 15118-2 over TLS 1.2. The steps below use -2.
  2. On the Demo CSMS card choose Act as CSMS → Set up Plug & Charge. You’ll see InstallCertificate for the V2G roots, TriggerMessage SignV2GCertificate, one SignCertificate per key type (P-256 only by default on 2.0.1, since 2.0.1 covers ISO 15118-2; on 2.1 P-256 and P-521, with Ed448 under Configuration → Charger behaviour; the handbook’s Configuration section lists the key types per OCPP version), the CertificateSigned replies and then GetCertificateStatus for the new certificates.
  3. Keep the valid contract and plug in the cable. Filter the conversation to ISO 15118 to follow the steps: SDP and the TLS version (the charger picks TLS 1.2, since it has no ISO 15118-20 certificate), the TLS check of the charger’s certificate and the real TLS 1.2 handshake, SupportedAppProtocol agreeing on ISO 15118-2, SessionSetup, PaymentDetails with the contract, the car’s signed AuthorizationReq and the charger’s check of that signature, the charger’s own check of the contract chain, then Authorize with the eMAID and OCSP data. The session starts.
  4. Unplug, pick the revoked contract and plug in. The Demo CSMS answers Invalid with CertificateRevoked, and the charger screen says the contract is revoked. The expired contract gets Expired with CertificateExpired. Rey labels the two refusals REY-PNC-001 and REY-PNC-002, and the Explain button on the charger screen says which side most likely caused each one and what to check.
  5. Optional: get a contract from the CSMS. Unplug, pick No contract yet: ask for one under the ISO 15118-2 contracts on EV & contracts, and plug in. The car sends CertificateInstallationReq, signed with its OEM provisioning key, the charger forwards it unchanged in Get15118EVCertificate (action Install), and the Demo CSMS, playing the contract provider, answers with a new contract whose private key only the car can decrypt. The car charges with it in the same session. The handbook’s contract installation section also covers renewal (action Update).

Plug and Charge refused on OCPP 2.0.1: the charger screen says Not accepted, contract revoked; the conversation shows the TLS 1.2 handshake, EXI messages on the TLS 1.2 connection from SupportedAppProtocol picking ISO 15118-2 to PaymentDetails with contract DE-REY-CREVOKED1-2, then Authorize and the Demo CSMS's reply Invalid with certificateStatus CertificateRevoked, AuthorizationRes Failed, and the car closing the connection.

The Demo CSMS follows the table above: Invalid for the revoked contract, Expired for the expired one. Compare your CSMS’s answers with it.

To read the car-to-charger side in Wireshark, choose Export → Capture (pcapng) with the TLS keys before you disconnect. The file carries the session’s TLS keys, so Wireshark decrypts it by itself (handbook: Wireshark).

With your own CSMS. Switch to My CSMS and connect. Then work through the matrix:

  • Provisioning. From your backend, send InstallCertificate for your test V2G root and TriggerMessage SignV2GCertificate (on OCPP 2.1, also SignV2G20Certificate for the ISO 15118-20 key types). Rey answers with a CSR per key type and checks your CertificateSigned against the key behind each CSR. Each CSR’s subject is C = country code, O = organization, CN = SECC ID and DC=CPO for the P-256 key, or DC=CSO for a P-521 or Ed448 key. The SECC ID defaults to the full EVSE ID and the organization to the operator ID. Set them under Configuration → Charger profile (SECC ID (CN), Organization (O)) before you connect, or live with ISO15118Ctrlr.SeccId and ISO15118Ctrlr.OrganizationName; they apply to the next CSR. For an ISO 15118-20 PKI, enter the SECC ID it gave you. Then check that your CSMS signs the subject your PKI expects, and signs each edition’s CSR with that edition’s chain: if a -20 certificate comes back signed by the -2 chain, or the other way round, the Certificates & security page marks it (“signed by the ISO 15118-2 chain”) and the charger logs a warning, because a car of that edition won’t accept it. That page groups the certificates by edition, each chain from its root down to the charger’s certificate, plus a Charger ↔ CSMS group, and each certificate opens for its full serial number (Certificates & security in the handbook). Copy PEM copies a certificate and Copy chain copies the charger’s own certificate with its sub-CAs, leaf first, so you can read what your CSMS signed with openssl x509 -in cert.pem -noout -text.
  • Your own contracts. In the certificate manager, drop the contract certificate, its MO sub-CAs and its private key from your test PKI (PEM or DER), plus the V2G root. Rey sorts them into chains and flags expired ones. Use test certificates only: they stay in your browser, and Rey’s server holds them only for the session, in memory.
  • No root on the charger. Don’t install a V2G or MO root. Rey notes that the charger can’t check the contract chain itself and sends the chain in certificate, so you can test central contract validation. Where a real car or charger would give up earlier, for example with no V2G certificate on the charger, Rey warns and carries on; tick Stop where a real car or charger would stop to see the strict behaviour instead.
  • eMAID only. Choose eMAID only on the EV & contracts page. The Authorize carries the eMAID and no certificate data.
  • Local list. Add the eMAID on Local auth list. Rey authorizes the contract locally and sends no Authorize.
  • Contract installation. Load your car’s OEM provisioning certificate and key, pick No contract yet: ask for one and plug in. Your CSMS receives Get15118EVCertificate with the car’s real EXI request, and the car checks your contract provider’s answer as a real car would.

Rey also checks your answers. It warns when an Authorize with certificate data comes back without a certificateStatus, and when your CSMS accepts a contract the charger itself found invalid (REY-PNC-010 and REY-PNC-011, each with an Explain button).

To run this matrix as a list, Rey’s Test suite has 16 Plug & Charge tests on OCPP 1.6 and 2.0.1 and 20 on 2.1, in two editions: ISO 15118-2 and ISO 15118-20. On 1.6 and 2.0.1 the -20 tests go beyond what OCPP specifies, and Rey says so. Your CSMS has to trust Rey’s test contract roots, which setup offers to download.

Know the bench’s limits

The virtual car and the charger both run inside Rey. The ISO 15118 messages between them are real EXI, made with EVerest’s open-source encoder (libcbv2g), on a real connection: TLS 1.2 for ISO 15118-2, and TLS 1.3 with mutual authentication for ISO 15118-20. But the cable is in memory, so there is no powerline link or SLAC and no real car’s timing, and Rey is not a conformance tool. On OCPP 2.1 it follows the split described above: SignV2GCertificate gets the P-256 certificate as V2GCertificate, and SignV2G20Certificate gets the P-521 and Ed448 ones as V2G20Certificate; a trigger for a key type the charger doesn’t hold is Rejected. The charger checks the car’s ISO 15118-20 vehicle certificate on every OCPP version, against its V2G roots, because the CharIN PKI for -20 puts vehicle certificates under the V2G root. On OCPP 2.1 your CSMS can also install a separate vehicle root as OEMRootCertificate, and the charger asks your CSMS whether the vehicle chain is revoked with GetCertificateChainStatus (use case M07); a revoked certificate stops a strict run. OCPP 1.6 and 2.0.1 have no message for that, so Rey notes that it can’t check. If a -20 contract is refused, the car doesn’t switch to ISO 15118-2 in the same session, because the edition is agreed when the car plugs in: start the charge with a card or the app instead. The ISO 15118-20 testing guide covers all of this step by step.

The honest summary

Most Plug & Charge failures that reach a driver were decided long before the car arrived: a charger that was never given a V2G certificate, a root that wasn’t installed, a CSMS that never learned to return a certificateStatus. None of those need a car to find.

So test the OCPP half on a bench first and treat the pilot as a test of the car-to-charger half only. When the first real car fails, you will then know which half to look at, which is most of the work of debugging Plug & Charge.