import-certificate command - Manual - Hardware Compiler - The AX Hardware Compiler - Hardware Compiler (hwc),tool

Hardware Compiler CLI Tool (hwc)

Portfolio
SIMATIC AX
Product
Hardware Compiler
Software version
1.1.154
Edition
07/2024
Language
English (original)
Package Name
@ax/hwc
apax hwc import-certificate --name <PLC_NAME> --input <HARDWARE_DECLARATION> --certificate <CERTIFICATE_FILE_PATH> --password <CERTIFICATE_PASSWORD> --purpose <PURPOSE_OF_CERTIFICATE_USAGE>
  • Imports a PKCS12 certificate, which contains public and private keys, into the project. This certificate will be used for the specified purpose. One example is using the certificate for enabling secure (TLS) communication between AX and a PLC.
    • Imported certificate's content will be persisted inside the same security configuration file, which is generated by the setup-secure-communication command. This file contains key-value pairs, where keys are human-readable strings and values are machine-readable byte arrays.
    • The TLS certificate is a mandatory input for a successful compile of S7-1500 PLCs as Hardware Engineering @AX only supports TLS communication. Therefore import-certificate command must be run at least once with --purpose TLS parameters prior to execution of hwc compile command for S7-1500 PLCs.

Options

Option Description
-i, --input Path to directory or file of the textual hardware declaration for compile. Mandatory.
This parameter can be specified multiple times.
-n, --name Unique name of a PLC, which must already be existing in the hardware configuration. Mandatory
-C, --certificate Path to the certificate file that contains public and private keys. Mandatory
-p, --password (optional) Password of the certificate if the certificate is password protected. It is strongly recommended to always protect a certificate's private key .
--purpose The purpose for which the imported certificate should be used (TLS, WebServer, SysLogClient, OpcUaServer). Mandatory

Return codes

The following return codes are possible:

  • 0 - Certificate was imported successfully.
  • ≠0 - An error occurred during certificate import.

Important

Before running the import-certificate command, setup-secure-communication command must be executed. This implies existence of a valid security configuration file in the same folder as the hardware declaration.