Пример #1
0
        private void populate_tags(byte[] data, Kind type)
        {
            TLVList tlvList = new TLVList();

            tlvList.Deserialize(data, true);
            foreach (TLV tlv in tlvList)//each E3
            {
                AID aid    = new AID(tlv.Children.Get("4F").Value);
                AID domain = null;
                if (tlv.Children.IsPresent("CC"))
                {
                    domain = new AID(tlv.Children.Get("CC").Value);
                }

                if (type == Kind.ExecutableLoadFile)
                {
                    GPRegistryEntryPkg pkg = new GPRegistryEntryPkg();
                    pkg.setType(type);
                    pkg.setAID(aid);
                    pkg.setDomain(domain);
                    pkg.setVersion(tlv.Children.Get("CE").Value);

                    foreach (TLV tlv84 in tlv.Children)
                    {
                        if (tlv84.Tag.TagLable == "84")
                        {
                            AID a = new AID(tlv84.Value);
                            pkg.addModule(a);
                        }
                    }
                    pkg.setLifeCycle(tlv.Children.Get("9F70").Value[0] & 0xFF);

                    add(pkg);
                }
                else
                {
                    GPRegistryEntryApp app = new GPRegistryEntryApp();
                    app.setType(type);
                    app.setAID(aid);
                    app.setDomain(domain);

                    Privileges privs = Privileges.fromBytes(tlv.Children.Get("C5").Value);
                    app.setPrivileges(privs);

                    if (tlv.Children.IsPresent("C4"))
                    {
                        AID a = new AID(tlv.Children.Get("C4").Value);
                        app.setLoadFile(a);
                    }

                    app.setLifeCycle(tlv.Children.Get("9F70").Value[0] & 0xFF);

                    add(app);
                }
            }
        }
Пример #2
0
 public void add(GPRegistryEntry entry)
 {
     // "fix" the kind at a single location.
     if (entry is GPRegistryEntryApp)
     {
         GPRegistryEntryApp app = (GPRegistryEntryApp)entry;
         if (app.getPrivileges().has(Privilege.SecurityDomain) && entry.getType() == Kind.Application)
         {
             entry.setType(Kind.SecurityDomain);
         }
     }
     entries.Add(entry.getAID(), entry);
 }