Skip to content

Commit

Permalink
Fix validation of Nonce length
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsuciu committed Jun 14, 2024
1 parent b6ce654 commit b5db0fb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions Stack/Opc.Ua.Core/Security/Certificates/Nonce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ public static uint GetNonceLength(string securityPolicyUri)
{
switch (securityPolicyUri)
{
case SecurityPolicies.Basic128Rsa15:
{
return 16;
}

case SecurityPolicies.Basic256:
case SecurityPolicies.Basic256Sha256:
case SecurityPolicies.Aes128_Sha256_RsaOaep:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ protected bool ValidateNonce(X509Certificate2 certificate, byte[] nonce)
}

// check the length.
if (nonce == null || nonce.Length < Nonce.GetNonceLength(SecurityPolicyUri))
if (nonce == null || nonce.Length != Nonce.GetNonceLength(SecurityPolicyUri))
{
return false;
}
Expand Down

0 comments on commit b5db0fb

Please sign in to comment.