Hello,
On Xamarin platforms, the Validate
method uses the platform's (Android's or iOS's) native certificate validation routines to check whether the certificate chain is valid. The "Windows certificate infrastructure" is only used on Windows operating system. We forgot to update the information - sorry for the confusion!
There is no method to "check the chain certificate from two certificates", and I'm not quite sure what purpose would that serve. However, if you have two certificate chains (= two instances of Rebex CertificateChain
class), and you wish to ensure they both chain up to the same root CA, you can simply compare the two root certificates to make sure they are identical:
CertificateChain chain1 = ...;
CertificateChain chain2 = ...;
byte[] certData1 = chain1.RootCertificate.GetRawCertData();
byte[] certData2 = chain2.RootCertificate.GetRawCertData();
bool hasSameRoot = CompareArrays(certData1, certData2);
public static bool CompareArrays(byte[] a, byte[] b)
{
if (a == null)
throw new ArgumentNullException("a");
if (b == null)
throw new ArgumentNullException("b");
if (a.Length != b.Length)
return false;
for (int i = 0; i < a.Length; i++)
{
if (a[i] != b[i]) return false;
}
return true;
}