Contenuto principale

opc.ua.trustServerCertificate

Add OPC UA server certificate to MATLAB OPC UA client's trusted certificate store

Since R2026a

    Description

    opc.ua.trustServerCertificate(serverCertificate) adds the server certificate to the trusted certificate store of the MATLAB® OPC UA client. Specify the full path to the server certificate including the certificate filename in serverCertificate.

    MATLAB allows an OPC UA client to connect to the OPC UA server only if the application instance certificate of the server is included in the trusted certificate store of the client.

    example

    Examples

    collapse all

    Create an OPC UA client for the new OPC UA server.

    uaClientObj = opcua("opc.tcp://localhost:53530/OPCUA/SimulationServer1");

    Add the server certificate to the trusted certificate store of the client. After adding the certificate, you can connect to the server from any MATLAB OPC UA client on the local system.

    opc.ua.trustServerCertificate("C:\path\to\server\certificate\serverCert.der");

    Connect to the new server.

    connect(uaClientObj);

    Check connection status.

    isConnected(uaClientObj)
    1

    Input Arguments

    collapse all

    Full file path to the OPC UA server certificate, specified as a string or character vector. The server certificate must be in .der format.

    Example: "C:\path\to\server\certificate\serverCert.der"

    Data Types: string | char

    Version History

    Introduced in R2026a