主要内容

opc.ua.rejectServerCertificate

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

Since R2026a

    Description

    opc.ua.rejectServerCertificate(serverCertificate) adds the server certificate to the rejected certificate store of the MATLAB OPC UA client. Specify the full path to the server certificate including the certificate name in serverCertificate.

    You can prevent a MATLAB® OPC UA client from connecting to an OPC UA server by including the application instance certificate of the server in the rejected certificate store of the MATLAB OPC UA client.

    example

    Examples

    collapse all

    Create an OPC UA client for the OPC UA server.

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

    Add the server certificate to the rejected certificate store of the client.

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

    Connect to the server and verify that the connection fails.

    connect(uaClientObj);

    Error using opc.ua.Client/connect (line 661) Server certificate is not trusted by the MATLAB OPC UA client. Use the opc.ua.trustServerCertificate function to trust the server certificate

    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