-

SEC_VERIFY_DEVICE_IDENTITY

TypeFunction block
DescriptionYou can use this function block to check whether your IEC program runs on a trusted device. Otherwise, you may take protective measures, for example, to prevent device damage or to avoid know-how piracy.

The function block verifies the identity of the device with cryptographic methods and returns details of the device. For the verification, the function block uses the PHOENIX device certificate hierarchy containing the root certificates in PEM-coded format. You can read the PHOENIX device certificate hierarchy from the device using the SEC_TA4PLCNEXT_1ST_GEN function block. In case of successful verification, details about the verified identity are provided at the outputs.

To verify the identity, it is checked whether the device contains a matching private key, and whether it can apply this key. If a Secure Element (SE) of the device (for example, a TPM chip) holds the private key, it is ensured that the device is a "real" device as specified by the issuer of the identity.

With a rising edge at the EXECUTE input, the string containing the PHOENIX device certificate hierarchy applied to the TRUSTED_CERTIFICATES input is verified. While verification takes place, the BUSY output is set to TRUE. Once the verification is completed, the BUSY output is set to FALSE and the DONE output is set to TRUE if the verification returns a positive result. In case of an error or if the identity could not be verified, the DONE output remains FALSE and the ERROR output is set to TRUE. If ERROR = TRUE, the ERROR_ID output provides details about the error.
Notes on the safety-related use
  • Certificates which are hard-coded in the IEC program should be applied to the TRUSTED_CERTS input. If, for example, the IEC program reads the certificates from a file, an attacker could run an IEC program on an untrusted controller in the way that a positive verification result of the device identity is returned. The attacker could achieve this by writing a self-defined identity as well as a self-defined number of trusted certificates that match with the identity into the file.
  • PLCnext Technology controllers provide the "IDevID" identity (Initial Secure Device Identifier). This identity is bound to the Secure Element (SE) of the controller. The "IDevID" value (STRING#'IDevID') can be connected to the IDENTITY_NAME input (see the application example below). Other identities are possibly not bound to the Secure Element of the device. In case of a positive verification with connected "IDevID" value, the SUBJECT_SN output provides the name of the device type and the SUBJECT_SN output the serial number of the device.
ParametersInputs

EXECUTE

TRUSTED_CERTS

IDENTITY_NAME

Outputs

DONE

BUSY

SUBJECT

SUBJECT_CN

SUBJECT_SN

ERROR

ERROR_ID
Application example