Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e588f52

Browse files
authored
Conformance fix: Remove trustpath subject-issuer comparison (#555)
* Revert "Conformance-breaking: Keep the stricter rules" This reverts commit ac11a81. * Improve comments
1 parent 9d8bc40 commit e588f52

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

‎Src/Fido2/Extensions/CryptoUtils.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ public static bool ValidateTrustChain(X509Certificate2[] trustPath, X509Certific
5858
// The array does not represent a certificate chain, but only the trust anchor of that chain.
5959
// A trust anchor can be a root certificate, an intermediate CA certificate or even the attestation certificate itself.
6060

61-
// Let's check the simplest case first. If subject and issuer are the same, and the attestation cert is in the list, that's all the validation we need
62-
63-
// We have the same singular root cert in trustpath and it is in attestationRootCertificates
64-
if (trustPath.Length == 1 && trustPath[0].Subject.Equals(trustPath[0].Issuer, StringComparison.Ordinal))
61+
// Single certificate case: if it matches a declared trust anchor, validation is complete
62+
if (trustPath.Length == 1)
6563
{
6664
foreach (X509Certificate2 cert in attestationRootCertificates)
6765
{
@@ -72,7 +70,7 @@ public static bool ValidateTrustChain(X509Certificate2[] trustPath, X509Certific
7270
}
7371
}
7472

75-
// If the attestation cert is not self signed, we will need to build a chain
73+
// For certificates not directly declared as trust anchors, build and validate a certificate chain
7674
var chain = new X509Chain();
7775

7876
// Put all potential trust anchors into extra store

‎Tests/Fido2.Tests/CryptoUtilsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public void TestValidateTrustChainSubAnchor()
6666

6767
Assert.False(0 == attestationRootCertificates[0].Issuer.CompareTo(attestationRootCertificates[0].Subject));
6868
Assert.True(CryptoUtils.ValidateTrustChain(trustPath, attestationRootCertificates));
69-
Assert.False(CryptoUtils.ValidateTrustChain(trustPath, trustPath));
70-
Assert.False(CryptoUtils.ValidateTrustChain(attestationRootCertificates, attestationRootCertificates));
69+
Assert.True(CryptoUtils.ValidateTrustChain(trustPath, trustPath));
70+
Assert.True(CryptoUtils.ValidateTrustChain(attestationRootCertificates, attestationRootCertificates));
7171
Assert.False(CryptoUtils.ValidateTrustChain(attestationRootCertificates, trustPath));
7272
}
7373

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /