setSecurityModel (opcua)

Set security configuration parameters for OPC UA client

Description

example

setSecurityModel(UaClient,'Best') sets both the MessageSecurityMode and ChannelSecurityPolicy properties of the OPC UA client UaClient to the best possible security configuration available for the server. The client attempts to retrieve available endpoints from the server if those are not yet retrieved.

setSecurityModel(UaClient,MessageMode,ChannelPolicy) sets the MessageSecurityMode and ChannelSecurityPolicy properties of OPC UA client UaClient to the specified MessageMode and ChannelPolicy, respectively. If a matching endpoint cannot be found in the list of known endpoints, an error occurs.

Examples

collapse all

Set the OPC UA client security mode for signed but not encrypted messages.

s = opcuaserverinfo('localhost');
UaClient = opcua(s);
setSecurityModel(UaClient,'Sign');
connect(UaClient);

Input Arguments

collapse all

OPC UA client, specified as an opc.ua.Client object. You can create the client using the opcua function.

Example: opcua()

Client message security mode, specified as a character vector or string. Either MessageMode or ChannelPolicy can be empty, but not both. In this case, the highest security model is chosen from the available endpoints to match the given option.

Example: 'Sign'

Data Types: char | string

Client channel security policy, specified as a character vector or string.

ChannelPolicy must be specified as one of the enumerations defined in opc.ua.ChannelSecurityPolicies. For example,

enumeration opc.ua.ChannelSecurityPolicies
Enumeration members for class 'opc.ua.ChannelSecurityPolicies':

    Invalid
    None
    Basic128Rsa15
    Basic256
    Aes128_Sha256_RsaOaep
    Basic256Sha256
    Aes256_Sha256_RsaPss

Example: 'Basic256'

Data Types: char | string

Introduced in R2020a