示例#1
0
        private void CreaSE(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
            {
                return;
            }
            ICardObject obj = treeView1.SelectedNode.Tag as ICardObject;

            if (!(obj is DF))
            {
                return;
            }
            DF df = obj as DF;

            card.CreateSE(1, df);
        }
        byte[] CreateSE(TLV seci)
        {
            var Id   = seci[0x83];
            var Data = seci[0x8F];
            var AC   = seci[0x86];

            if (Id == null)
            {
                return(Error.DataFieldNotValid);
            }
            if (Data == null)
            {
                return(Error.DataFieldNotValid);
            }
            if (AC == null)
            {
                return(Error.DataFieldNotValid);
            }

            if (Id.Length != 1)
            {
                return(Error.DataFieldNotValid);
            }
            if (Data.Length != 6)
            {
                return(Error.DataFieldNotValid);
            }

            if (context.CurDF == null)
            {
                return(Error.ClaNotValid);
            }

            if (!handler.IsVerifiedAC(context.CurDF, DF_AC.AC_APPEND))
            {
                return(Error.SecurityStatusNotSatisfied);
            }

            var se = card.CreateSE(Id[0], context.CurDF);

            se.AC.Set(AC);
            se.Data = Data;

            return(Error.Ok);
        }