mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-23 10:23:13 +08:00
cr feedback. keep set methods, but private. catch the bc exception and respect the throwOnError parameter.
This commit is contained in:
@@ -160,6 +160,7 @@ namespace Opc.Ua
|
||||
public string KeyId
|
||||
{
|
||||
get { return m_keyId; }
|
||||
private set { m_keyId = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -168,6 +169,7 @@ namespace Opc.Ua
|
||||
public string[] AuthorityNames
|
||||
{
|
||||
get { return m_authorityNames; }
|
||||
private set { m_authorityNames = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -176,6 +178,7 @@ namespace Opc.Ua
|
||||
public string SerialNumber
|
||||
{
|
||||
get { return m_serialNumber; }
|
||||
private set { m_serialNumber = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -114,8 +114,19 @@ namespace Opc.Ua
|
||||
public bool VerifySignature(X509Certificate2 issuer, bool throwOnError)
|
||||
{
|
||||
m_issuer = issuer;
|
||||
Org.BouncyCastle.X509.X509Certificate bccert = new X509CertificateParser().ReadCertificate(issuer.RawData);
|
||||
m_crl.Verify(bccert.GetPublicKey());
|
||||
try
|
||||
{
|
||||
Org.BouncyCastle.X509.X509Certificate bccert = new X509CertificateParser().ReadCertificate(issuer.RawData);
|
||||
m_crl.Verify(bccert.GetPublicKey());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (throwOnError)
|
||||
{
|
||||
throw new ServiceResultException(StatusCodes.BadCertificateInvalid, "Could not verify signature on CRL.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user