Closed ganko-pi closed 2 weeks ago
@ganko-pi thank you for the Details i will take a look, could you eventually provide the crl containing the "invalid" certificate?
Here is the crl containing the certificate with an MD2 hash. The file extension must be changed back from .crl.txt to .crl due to GitHub not allowing the upload of a file with .crl. cert_with_md2_hash.crl.txt
Type of issue
Current Behavior
A
System.Security.Cryptography.CryptographicException
with message "Hash algorithm 1.2.840.113549.1.1.2 is not supported." occurs during connection to an OPC UA server when there is a certificate on a certificate revocation list (CRL) in the Windows certificate store which has an unsupported hash algorithm (in my specific case MD2 with OID 1.2.840.113549.1.1.2) even if it is not associated with OPC UA in any way. The error occurs in Opc.Ua.X509CertificateStore in line 255 because theIssuerName
could not be extracted due to the unknown hash.Expected Behavior
The
CryptographicException
should not fail the connection to the OPC UA server. If the certificate really belongs to the OPC UA connection the connection fails at a later point anyway.Steps To Reproduce
namespace OpcUaExample;
///
/// Class containing the entry point of the program.
///
public class Program
{
}
///
/// Class to manage a OPC UA session.
///
public class OpcUaSessionKeeper : IDisposable
{
private readonly string _opcUaUri;
private ISession? _opcUaSession;
private readonly ushort _opcUaCertificateLifetimeInMonths = 180;
}
CryptographicException
due to an unsupported hash algorithm of a certificateEnvironment
Anything else?
Log
Suggested fix
File: https://github.com/OPCFoundation/UA-.NETStandard/blob/release/1.5.374/Stack/Opc.Ua.Core/Security/Certificates/X509CertificateStore/X509CertificateStore.cs Line: 254 (first in
foreach
)