public void TrustedIssuerListJson2Object() { string jsonTrustedIssuerList = helper.ReadFile("TrustesIssuerList"); TrustedIssuerList trustedIssuerList = parser.ParseJsonToObject <TrustedIssuerList>(jsonTrustedIssuerList); TrustedIssuerList expectedTrustedIssuerList = GetTrustedIssuerListObject(); Assert.IsNotNull(trustedIssuerList.issuers[0]); helper.TestIP(expectedTrustedIssuerList.issuers[0], trustedIssuerList.issuers[0]); }
/// <summary> /// Checks if there exists an issuer in the trusted issuer list, with the given parameters <br/> /// if there does not exists an issuer in the list or the properties do not match, an error gets thrown /// </summary> private void CheckTrustedIssuer() { LogService.Log(LogService.LogType.Info, "IssuingVerifier - CheckTrustedIssuer called"); TrustedIssuerList trustedIssuers = parser.ParseJsonToObject <TrustedIssuerList>(trustedIssuerJson); foreach (IP trustedIP in trustedIssuers.issuers) { // uidp must be equals otherwise it is not the same issuer if (trustedIP.uidp == IP.UidP.ToBase64String()) { if (trustedIP.g[0] != IP.G[0].ToBase64String()) { throw new Exception("Issuer has the same UidP '" + trustedIP.uidp + "', but different g0"); } if (trustedIP.uidh != IP.UidH) { throw new Exception("TrustedIssuer - UidH not equals"); } if (trustedIP.s != IP.S.ToBase64String()) { throw new Exception("TrustedIssuer - S not equals"); } if (trustedIP.MaxNumberOfAttributes != IP.MaxNumberOfAttributes) { throw new Exception("TrustedIssuer - MaxNumberOfAttributes not equals"); } if (trustedIP.descGq.name != IP.Gq.GroupName) { throw new Exception("TrustedIssuer - GroupName not equals"); } LogService.Log(LogService.LogType.Info, "IssuingVerifier - Issuer found and passed tests"); return; } } throw new Exception("Given issuer is not in the trusted list"); }