mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-29 07:07:24 +08:00
Correct Basic256Sha256 security-level ranking (#4568)
# Description
`Aes128_Sha256_RsaOaep` was ranked above `Basic256Sha256` despite its
weaker AES-128 symmetric encryption. The calculated levels are swapped
to reflect their relative strength.
- **Security-level ranking**
- `Aes128_Sha256_RsaOaep`: `6`
- `Basic256Sha256`: `8`
```csharp
case SecurityPolicies.Basic256Sha256:
result = 8;
break;
case SecurityPolicies.Aes128_Sha256_RsaOaep:
result = 6;
break;
```
- **Regression coverage**
- Updates the policy-ordering test to assert the corrected relationship.
## Related Issues
## Checklist
- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [ ] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #4560
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
This commit is contained in:
@@ -393,10 +393,10 @@ namespace Opc.Ua.Security
|
||||
logger.SecuredApplicationHelpersLogMessage3(policyUri);
|
||||
result = 4;
|
||||
break;
|
||||
case SecurityPolicies.Basic256Sha256:
|
||||
case SecurityPolicies.Aes128_Sha256_RsaOaep:
|
||||
result = 6;
|
||||
break;
|
||||
case SecurityPolicies.Aes128_Sha256_RsaOaep:
|
||||
case SecurityPolicies.Basic256Sha256:
|
||||
result = 8;
|
||||
break;
|
||||
case SecurityPolicies.Aes256_Sha256_RsaPss:
|
||||
|
||||
@@ -94,15 +94,15 @@ namespace Opc.Ua.Core.Tests.Schema
|
||||
Assert.That(
|
||||
SecuredApplication.CalculateSecurityLevel(
|
||||
MessageSecurityMode.Sign,
|
||||
SecurityPolicies.Basic256Sha256, logger),
|
||||
SecurityPolicies.Aes128_Sha256_RsaOaep, logger),
|
||||
Is.LessThan(SecuredApplication.CalculateSecurityLevel(
|
||||
MessageSecurityMode.Sign,
|
||||
SecurityPolicies.Aes128_Sha256_RsaOaep, logger)));
|
||||
SecurityPolicies.Basic256Sha256, logger)));
|
||||
|
||||
Assert.That(
|
||||
SecuredApplication.CalculateSecurityLevel(
|
||||
MessageSecurityMode.Sign,
|
||||
SecurityPolicies.Aes128_Sha256_RsaOaep,
|
||||
SecurityPolicies.Basic256Sha256,
|
||||
logger
|
||||
),
|
||||
Is.LessThan(SecuredApplication.CalculateSecurityLevel(
|
||||
|
||||
@@ -450,6 +450,8 @@ namespace Opc.Ua.Subscriptions.Classic.Tests
|
||||
const int monitoredItemsPerSubscription = 50;
|
||||
const int subscriptions = 50;
|
||||
const int maxServerPublishRequest = 20;
|
||||
// Server revises the requested publishing interval of 0 to 100 ms
|
||||
const int samplingInterval = 100;
|
||||
|
||||
for (int i = 0; i < subscriptions; i++)
|
||||
{
|
||||
@@ -473,7 +475,9 @@ namespace Opc.Ua.Subscriptions.Classic.Tests
|
||||
new TestableMonitoredItem(subscription.DefaultItem)
|
||||
{
|
||||
StartNodeId = nextNode,
|
||||
SamplingInterval = 0
|
||||
// Sample at the revised publishing interval to keep
|
||||
// the server load of 2500 items bounded on CI hosts
|
||||
SamplingInterval = samplingInterval
|
||||
});
|
||||
}
|
||||
var dict = list.ToDictionary(item => item.ClientHandle, _ => DateTime.MinValue);
|
||||
|
||||
Reference in New Issue
Block a user