beckhoff TwinCAT 3 — 2.4.13 certificate

TwinCAT Package Manager (TwinCAT 3.1.4026) | Working with the command line After signing, the package signature is verified to confirm its validity. To do this, the TcPkg certificate must be recognized as trusted . Examples: To sign a package, follow these steps: Company policies on private keys Your company or IT department may have policies and guidelines that require the private key to be more securely protected and, therefore, generated in a different way along with the certificate. Nowadays, for example, it is common practice to protect the private key within the hardware, such as with a crypto token. Check to see if such policies exist in your company, and take them into account. 1.

Generating your own certificate for the signature The following PowerShell script provides an example of how to create a certificate, store the private key in the user’s certificate store, export it as a PFX file, and export the public key as a CER file:

$cert = New-SelfSignedCertificate ` -Subject "CN=TcPkg Test Signing" ` -KeyUsage DigitalSignature ` -Type CodeSigning ` -CertStoreLocation "Cert:\CurrentUser\My" ` -NotAfter (Get-Date).AddYears(2) $password = ConvertTo-SecureString -String "test1234" -Force -AsPlainText Export-PfxCertificate ` -Cert $cert ` -FilePath ".\test-signing.pfx" ` -Password $password Export-Certificate ` -Cert $cert ` -FilePath ".\test-signing.cer" Write-Host "Thumbprint: $($cert.Thumbprint)" Write-Host "Private Key exported to: $(Resolve-Path '.\test-signing.pfx')" Write-Host "Public Key exported to: $(Resolve-Path '.\test-signing.cer')" 2.

Adding the certificate with the private key to the TwinCAT Package Manager’s certificate store tcpkg certificate add C:\Users\User\test-signing.pfx -p “test1234” 3. Signing a newly created package tcpkg sign C:\Users\User\Documents\MyPackages\NewPackage.1.0.0.nupkg --timestamp-server None -- thumbprint --verify-after-signing 4. Providing the package and public key to customers or colleagues 2.4.13 certificate | certificate Command: certificate Description : TcPkg stores a whitelist of trusted X.509 certificates in the Windows certificate store. You can manage them using this command. Packages signed with these certificates are trusted. Use :

tcpkg certificate [subcommand] [options] Subcommands Subcommand : add Description : Use this to add trusted certificates to the whitelist. Packages signed with these are trusted. Use: tcpkg certificate add Arguments : TwinCAT 3 40 Version: 2.3.1