public void Assign(ASN1Object ob) { /// mozda ne bi bilo lose da se /// prije provjeri da li ovaj tip uopce smije /// biti u ovoj CHOICE strukturi... /// /// laters. this.chosen = ob; /// ??? /// \/ /// Ovo prespajanje treba napraviti tako da se moze /// testirati MatchType... inace ovaj objekt ostaje /// sa Tag == 0. //this.Tag = ob.Tag; /* * this.aTag = new MultiASN1TAG(ob.aTag) * */ }
public virtual void Assign(ASN1Object ulazASN1) { this.underObject = ulazASN1; ///This one is usually a no-op, unless overriden. this.RegisterComponents(); }
public override void RegisterComponents() { this.algorithm = NextComponent() as ASN1ObjectIdentifier; this.parameters = NextComponent(); // notice the missing cast... // since the type cannot be resolved at compile-time this ASN1Object // member has no cast. }
public override void RegisterComponents() { this.type = NextComponent() as ASN1ObjectIdentifier; this.value = NextComponent(); // as WHAT? this.valuesWithContext = NextComponent() as ValuesWithContext; /// povezi!!! this.unique_TypeInfo.uoid = this.type; }
public virtual bool CheckType(ASN1Object obo) { return true; /* OOOPS */ }
public static void DumpDERToFile(ASN1Object ob, String filename) { try { FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write); BERWriter br = new BERWriter(fs); br.Write(ob.asDER().GetBERCode()); fs.Close(); br.Close(); } catch { Console.WriteLine("Failed at writing Data BER to file."); } }
public static void DumpHEX(ASN1Object ob) { DumpHEX(ob.asDER()); }
public virtual void Add(ASN1Object obo) { if (this.CheckType(obo)) { this.Elements.Add(obo); } else { throw new Exception("Wrong type for this SEQUENCE OF"); } }
/// <summary> /// Must rename this to CheckTag... an introspection any deeper /// than this is pointless.. /// </summary> /// <param name="obo"></param> /// <returns></returns> public virtual bool CheckType(ASN1Object obo) { //return ASN1Type.MatchType(obo, _type); return true; }
protected virtual void DoComponentAssign(int j, ASN1Object ulaz) { this.Components[j] = ulaz; }
protected void RegType(ASN1Type tip, ASN1Object defaultValue) { this.ComponentTypes[typeCounter] = ASN1ComponentTypeInfo.Make(tip, defaultValue); typeCounter++; }
/// <summary> /// MUST CHANGE, MOVE OR WHATEVER.... /// usage - u ASN1Sequence.. /// /// <para>Returns true if ASN1Object ob and ASN1Type tip match.</para> /// </summary> /// <param name="ob"></param> /// <param name="tip"></param> /// <returns></returns> public static bool MatchType(ASN1Object ob, ASN1Type tip) { if ((tip == null)||(ob==null)) { /// Ovo je zbog SET OF. /// Nadam se da necu platiti penale za ovo. :-( return true; } if (tip.SkipMatch) { return true; } else if (tip.Tags != null) { return (tip.Tags.Contains(ob.Tag)); } else return (ob.Tag == tip.Tag); }
private void DecodeByTagNumber(int tagNum, BEREncoding ulazBER) { /// BAAAD!!! foreach (ASN1Type tip in this.Alternatives) { if (tagNum == tip.Tag) { this.chosen = tip.CreateInstance(ulazBER); this.Tag = tagNum; return; } } throw new Exception("Unrecognized alternative in CHOICE!"); }