Quickstart
Register one device and get its certificate in the sandbox (https://api.pki-dev.solar-on.org). It takes about ten minutes.
Before you start
Section titled “Before you start”- Your vendor is approved in the sandbox portal (https://portal.pki-dev.solar-on.org) for inverter security modules.
- From the portal’s API keys page you have the private key you made the CSR with (
client.key), the client certificate you downloaded (client.crt), and the key value (slzp_test_…). The key needs thedevices.writeandcerts.issuescopes. - A terminal (macOS or Linux) with
curl,opensslandjq.
-
Environment and a helper. Run this in the folder with your key files. The
pkifunction adds the key and the client certificate to every call.터미널 창 # Replace with the values from the portalexport PKI_API=https://api.pki-dev.solar-on.orgexport PKI_API_KEY=slzp_test_your_key# client.key = the private key you made the CSR with, client.crt = the client certificate from the portalpki() {curl --silent --show-error --fail-with-body \--cert client.crt --key client.key \-H "Authorization: Bearer $PKI_API_KEY" \-H "Content-Type: application/json" "$@"} -
Check the connection. If you see the key name, vendor and scopes, you are ready. On
401, see Errors.터미널 창 # Check the key and certificatepki "$PKI_API/v1/me" | jq . -
Register a device. Add one device to the registry. Sending the same values again is not an error.
터미널 창 # Device serial (use a new one for each try)export DEVICE_SERIAL=SN-0001pki -X POST "$PKI_API/v1/devices" \-d "{\"devices\":[{\"serial\":\"$DEVICE_SERIAL\",\"deviceType\":\"module\"}]}" \| jq '{created, unchanged}' -
Device key and CSR. On a real device this happens inside the secure element. Here we do it in the terminal. The curve must be P-256.
터미널 창 # On the device: make a private key and a CSR. The private key never leaves the deviceopenssl ecparam -name prime256v1 -genkey -noout -out device.keyopenssl req -new -key device.key -subj "/CN=$DEVICE_SERIAL" -out device.csr -
Issue. Vendors on automatic issuance get the certificate right away: you see
approvedand the serial, and the chain is saved todevice-chain.pem. Vendors on manual issuance seependingand fetch the result after approval with Get an issuance request.터미널 창 jq -n --arg serial "$DEVICE_SERIAL" --rawfile csr device.csr \'{deviceSerial: $serial, csrPem: $csr}' \| pki -X POST "$PKI_API/v1/certificates" -d @- > issued.jsonjq -r '.request.status, .certificate.serial' issued.jsonjq -r '.chainPem' issued.json > device-chain.pem -
Verify the chain with the sandbox root.
device-chain.pem: OKmeans you are done.터미널 창 # Download the sandbox root from the repository and verify the chaincurl -sS https://pki-dev.solar-on.org/trust.json \| jq -r '.anchors[] | select(.kind == "root") | .pem' > root.pemopenssl verify -CAfile root.pem -untrusted device-chain.pem device-chain.pem
Next steps
Section titled “Next steps”- Many devices at once: Factory bulk issuance
- Before expiry: Renewing certificates
- The root to put on devices: Device trust anchors