private static bool AtvAreEqual(AttributeTypeAndValue atv1, AttributeTypeAndValue atv2) { if (atv1 == atv2) { return(true); } if (null == atv1 || null == atv2) { return(false); } DerObjectIdentifier o1 = atv1.Type; DerObjectIdentifier o2 = atv2.Type; if (!o1.Equals(o2)) { return(false); } string v1 = CanonicalString(atv1.Value); string v2 = CanonicalString(atv2.Value); if (!v1.Equals(v2)) { return(false); } return(true); }
public void It_has_an_AttributeTypeAndValue_model_with_a_default_ctor_that_doesnt_do_anything() { var it = new AttributeTypeAndValue(); Assert.IsNull(it.AttributeName); Assert.IsNull(it.AttributeValue); }
private static bool atvAreEqual(AttributeTypeAndValue atv1, AttributeTypeAndValue atv2) { if (atv1 == atv2) { return(true); } if (atv1 == null) { return(false); } if (atv2 == null) { return(false); } DerObjectIdentifier o1 = atv1.Type; DerObjectIdentifier o2 = atv2.Type; if (!o1.Equals(o2)) { return(false); } String v1 = IetfUtils.Canonicalize(IetfUtils.ValueToString(atv1.Value)); String v2 = IetfUtils.Canonicalize(IetfUtils.ValueToString(atv2.Value)); if (!v1.Equals(v2)) { return(false); } return(true); }
public virtual AttributeTypeAndValue[] ToAttributeTypeAndValueArray() { AttributeTypeAndValue[] array = new AttributeTypeAndValue[content.Count]; for (int i = 0; i != array.Length; i++) { array[i] = AttributeTypeAndValue.GetInstance(content[i]); } return(array); }
public void It_has_an_AttributeTypeAndValue_model_with_a_ctor_that_allows_you_to_set_AttributeValue_to_null_to_signify_removing_an_attributeValue() { var it = new AttributeTypeAndValue("attrName", null); Assert.AreEqual("attrName", it.AttributeName); Assert.IsInstanceOfType(it.AttributeValue, typeof(XmlElement)); var element = (XmlElement)it.AttributeValue; Assert.AreEqual("", element.InnerText); }
public void It_has_an_AttributeTypeAndValue_model_with_a_ctor_that_allows_you_to_set_the_AttributeName_and_AttributeValue() { var it = new AttributeTypeAndValue("attrName", "attrValue"); Assert.AreEqual("attrName", it.AttributeName); Assert.IsInstanceOfType(it.AttributeValue, typeof(XmlElement)); var element = (XmlElement)it.AttributeValue; Assert.AreEqual("attrValue", element.InnerText); }
public virtual AttributeTypeAndValue[] GetRegInfo() { if (regInfo == null) { return(null); } AttributeTypeAndValue[] array = new AttributeTypeAndValue[regInfo.Count]; for (int i = 0; i != array.Length; i++) { array[i] = AttributeTypeAndValue.GetInstance(regInfo[i]); } return(array); }
public static void AppendTypeAndValue( StringBuilder buf, AttributeTypeAndValue typeAndValue, IDictionary oidSymbols) { string sym = (string)oidSymbols[typeAndValue.Type]; if (sym != null) { buf.Append(sym); } else { buf.Append(typeAndValue.Type.Id); } buf.Append('='); buf.Append(ValueToString(typeAndValue.Value)); }
public AttributeTypeAndValue FindControl(DerObjectIdentifier type) { if (controls == null) { return(null); } AttributeTypeAndValue[] tAndV = controls.ToAttributeTypeAndValueArray(); AttributeTypeAndValue found = null; for (int i = 0; i < tAndV.Length; i++) { if (tAndV[i].Type.Equals(type)) { found = tAndV[i]; break; } } return(found); }
/// <summary> /// Return a control value of the specified type. /// </summary> /// <param name="type">the type OID for the control value we are checking for.</param> /// <returns>the control value if present, null otherwise.</returns> public IControl GetControl(DerObjectIdentifier type) { AttributeTypeAndValue found = FindControl(type); if (found != null) { if (found.Type.Equals(CrmfObjectIdentifiers.id_regCtrl_pkiArchiveOptions)) { return(new PkiArchiveControl(PkiArchiveOptions.GetInstance(found.Value))); } if (found.Type.Equals(CrmfObjectIdentifiers.id_regCtrl_regToken)) { return(new RegTokenControl(DerUtf8String.GetInstance(found.Value))); } if (found.Type.Equals(CrmfObjectIdentifiers.id_regCtrl_authenticator)) { return(new AuthenticatorControl(DerUtf8String.GetInstance(found.Value))); } } return(null); }