Exemplo n.º 1
0
 public EFLinearFixed(ushort ID, IISO7816Card owner, DF parent, uint size, byte recordSize)
     : base(ID, owner, parent)
 {
     this.recordSize = recordSize;
     maxRecords      = size / recordSize;
     this.size       = size;
 }
        public CardHandler(ICard cardOwner)
        {
            this.card       = cardOwner as IISO7816Card;
            context         = new CardContext();
            context.CurFile = card.MasterFile;

            commandMap[0x0044] = new ActivateFile();
            commandMap[0x00e2] = new AppendRecord();
            commandMap[0x9024] = new ChangeKeyData();
            commandMap[0x0024] = new ChangeReferenceData();
            commandMap[0x00e0] = new CreateFile();
            commandMap[0x0004] = new DeactivateFile();
            commandMap[0x0082] = new ExternalAuthenticate();
            commandMap[0x0046] = new GenerateKeyPair();
            commandMap[0x0084] = new GetChallenge();
            commandMap[0x8086] = new GiveRandom();
            commandMap[0x0022] = new ManageSecurityEnvironment();
            commandMap[0x002a] = new PerformSecurityOperation();
            commandMap[0x00da] = new PutData();
            commandMap[0x00b0] = new ReadBinary();
            commandMap[0x00b2] = new ReadRecord();
            commandMap[0x002c] = new ResetRetryCounter();
            commandMap[0x00a4] = new Select();
            commandMap[0x00d6] = new UpdateBinary();
            commandMap[0x00dc] = new UpdateRecord();
            commandMap[0x0020] = new Verify();


            foreach (var v in commandMap.Values)
            {
                v.Card    = card;
                v.Handler = this;
            }
        }
Exemplo n.º 3
0
 public EFCyclic(ushort ID, IISO7816Card owner, DF parent, uint size, byte recordSize)
     : base(ID, owner, parent)
 {
     this.recordSize = recordSize;
     OldestRecord    = 0;
     maxRecords      = size / recordSize;
     this.size       = size;
 }
Exemplo n.º 4
0
 public SecurityEnvironmenet(byte ID, IISO7816Card owner, DF parent)
 {
     id          = ID;
     this.owner  = owner;
     this.parent = parent;
     parent.Childs.Add(this);
     owner.ObjectChanged(this, ChangeType.Created);
     AC = owner.CreateAC(this);
 }
Exemplo n.º 5
0
 public EF(ushort ID, IISO7816Card owner, DF parent)
 {
     id = ID;
     this.owner = owner;
     this.parent = parent;
     parent.Childs.Add(this);
     owner.ObjectChanged(this, ChangeType.Created);
     AC = owner.CreateAC(this);
     SM = owner.CreateSM(this);
 }
Exemplo n.º 6
0
        public void SetCard(ICard ownedCard) {
            card = ownedCard as IISO7816Card;
            setOwner(this.card.MasterFile, this.card);
            card.objectChanged += new Action<ICard, ICardObject, ChangeType>(card_objectChanged);
            treeView1.Nodes.Clear();
            objNodes = new Dictionary<ICardObject, TreeNode>();

            card_objectChanged(card, card.MasterFile, ChangeType.Created);
            TreeAdd(card.MasterFile);
        }
Exemplo n.º 7
0
 public EF(ushort ID, IISO7816Card owner, DF parent)
 {
     id          = ID;
     this.owner  = owner;
     this.parent = parent;
     parent.Childs.Add(this);
     owner.ObjectChanged(this, ChangeType.Created);
     AC = owner.CreateAC(this);
     SM = owner.CreateSM(this);
 }
Exemplo n.º 8
0
        public void SetCard(ICard ownedCard)
        {
            card = ownedCard as IISO7816Card;
            setOwner(this.card.MasterFile, this.card);
            card.objectChanged += new Action <ICard, ICardObject, ChangeType>(card_objectChanged);
            treeView1.Nodes.Clear();
            objNodes = new Dictionary <ICardObject, TreeNode>();

            card_objectChanged(card, card.MasterFile, ChangeType.Created);
            TreeAdd(card.MasterFile);
        }
Exemplo n.º 9
0
 void setOwner(ICardObject obj, IISO7816Card owner)
 {
     obj.Owner = owner;
     if (obj is DF)
     {
         DF df = obj as DF;
         foreach (var c in df.Childs)
         {
             setOwner(c, owner);
         }
     }
 }
Exemplo n.º 10
0
 public BSO(ushort ID, IISO7816Card owner, DF parent)
 {
     id          = ID;
     this.owner  = owner;
     this.parent = parent;
     Blocked     = false;
     options     = new byte[8];
     parent.Childs.Add(this);
     owner.ObjectChanged(this, ChangeType.Created);
     AC = owner.CreateAC(this);
     SM = owner.CreateSM(this);
 }
Exemplo n.º 11
0
 public EFRecord(ushort ID, IISO7816Card owner, DF parent)
     : base(ID, owner, parent)
 {
     data = new List<byte[]>();
 }
Exemplo n.º 12
0
 public EFBinary(ushort ID, IISO7816Card owner, DF parent, uint size)
     : base(ID, owner, parent)
 {
     data = new byte[size];
 }
Exemplo n.º 13
0
 public EFLinearTLV(ushort ID, IISO7816Card owner, DF parent, uint size)
     : base(ID, owner, parent)
 {
     this.size = size;
 }
Exemplo n.º 14
0
 public EFCyclic(ushort ID, IISO7816Card owner, DF parent, uint size, byte recordSize)
     : base(ID, owner, parent)
 {
     this.recordSize = recordSize;
     OldestRecord = 0;
     maxRecords = size / recordSize;
     this.size = size;
 }
Exemplo n.º 15
0
 public EFLinearFixed(ushort ID, IISO7816Card owner, DF parent, uint size, byte recordSize)
     : base(ID, owner, parent) {
         this.recordSize = recordSize;
         maxRecords = size / recordSize;
         this.size = size;
     }
Exemplo n.º 16
0
 public EFLinearTLV(ushort ID, IISO7816Card owner, DF parent, uint size)
     : base(ID, owner, parent) {
         this.size = size;
 }
Exemplo n.º 17
0
 public EFRecord(ushort ID, IISO7816Card owner, DF parent)
     : base(ID, owner, parent)
 {
     data = new List <byte[]>();
 }
Exemplo n.º 18
0
 void setOwner(ICardObject obj, IISO7816Card owner)
 {
     obj.Owner = owner;
     if (obj is DF)
     {
         DF df = obj as DF;
         foreach (var c in df.Childs)
         {
             setOwner(c, owner);
         }
     }
 }
Exemplo n.º 19
0
 public EFBinary(ushort ID, IISO7816Card owner, DF parent,uint size)
     : base(ID, owner, parent)
 {
     data = new byte[size];
 }
Exemplo n.º 20
0
 public SecurityEnvironmenet(byte ID, IISO7816Card owner, DF parent)
 {
     id = ID;
     this.owner = owner;
     this.parent = parent;
     parent.Childs.Add(this);
     owner.ObjectChanged(this, ChangeType.Created);
     AC = owner.CreateAC(this);
 }
Exemplo n.º 21
0
        public CardHandler(ICard cardOwner)
        {
            this.card = cardOwner as IISO7816Card;
            context = new CardContext();
            context.CurFile = card.MasterFile;

            commandMap[0x0044] = new ActivateFile();            
            commandMap[0x00e2] = new AppendRecord();
            commandMap[0x9024] = new ChangeKeyData();
            commandMap[0x0024] = new ChangeReferenceData();
            commandMap[0x00e0] = new CreateFile();
            commandMap[0x0004] = new DeactivateFile();
            commandMap[0x0082] = new ExternalAuthenticate();
            commandMap[0x0046] = new GenerateKeyPair();
            commandMap[0x0084] = new GetChallenge();
            commandMap[0x8086] = new GiveRandom();
            commandMap[0x0022] = new ManageSecurityEnvironment();
            commandMap[0x002a] = new PerformSecurityOperation();
            commandMap[0x00da] = new PutData();
            commandMap[0x00b0] = new ReadBinary();
            commandMap[0x00b2] = new ReadRecord();
            commandMap[0x002c] = new ResetRetryCounter();
            commandMap[0x00a4] = new Select();
            commandMap[0x00d6] = new UpdateBinary();
            commandMap[0x00dc] = new UpdateRecord();
            commandMap[0x0020] = new Verify();
            

            foreach (var v in commandMap.Values) {
                v.Card = card;
                v.Handler = this;
            }

        }