Security Encryption
This section covers SDK encryption-related topics API and certificate tools.
Subpage Redirect
- For information on generating certificates, configuring server-to-server trust, and troubleshooting, please refer to Certificate Generation and Configuration.
- For information on how to pass security parameters when creating a Session, please refer to Constructor.
- For information on security mode detection supported by the server, please refer to GetEndpoints.
Three types SecurityMode
Statement (nested class Enums within ):
public enum MessageSecurityMode { Invalid, None, Sign, SignAndEncrypt }
Be sure to write the full name when using it Enums.MessageSecurityMode:
Enums.MessageSecurityMode.SignAndEncrypt
Pass the following when constructing a Session:
try (OpcUaSession ua = OpcUaSession.secureSignAndEncrypt(
"opc.tcp://server:4840", "C:\\certs\\client.pfx")) {
ua.connect();
}
| Mode | Data Integrity | Confidentiality | Applicable |
|---|---|---|---|
| None | × | × | Development / Internal Network / Debugging |
| Sign | ✓ | × | Tamper-proof, but not sniffer-proof |
| SignAndEncrypt | ✓ | ✓ | Production Recommendations |
SecurityPolicyUri
Support (Current Implementation):
http://opcfoundation.org/UA/SecurityPolicy#Nonehttp://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256(Primary Use)
When creating, let securityPolicyUri = null it automatically select based SDK on mode: None → #None, others → #Basic256Sha256.
UserToken
Statement (nested within class Enums ):
public enum UserTokenType { Anonymous, Username, Certificate, Issued }
Be sure to write the full name when using it Enums.UserTokenType:
Enums.UserTokenType.Username
Select by construction parameters:
| Token | Construction Parameters |
|---|---|
| Anonymous | Do not share username |
| Username | username: "...", password: "..." |
| Certificate | (To be refined in future versions) User Certificate Parameters |
| Issued | (This feature is not currently SDK available.) |
Encryption Quick Factory (Common)
public static OpcUaSession secureSign(String endpointUrl, String clientCertPath)
public static OpcUaSession secureSignAndEncrypt(String endpointUrl, String clientCertPath)
The default parameters are pre-packaged (Basic256Sha256, autoReconnect, KeepAlive 10s). All you need is the endpoint + PFX. For details, see Constructor.
For more details, see Certificate Generation and Configuration.