public BSO getSMKey(IObjectWithSM obj, byte SMcondition)
        {
            if (obj == null)
            {
                return(null);
            }
            byte SMkey = SM.NoSM;

            if (obj.SM != null)
            {
                SMkey = obj.SM[SMcondition];
            }
            if (SMkey == SM.NoSM)
            {
                return(null);
            }
            var df  = obj is DF ? (obj as DF) : (obj as ICardObject).Parent;
            var key = df.GetChildBSO(Util.ToUShort(BSOClass.SM, SMkey), true);

            if (key == null)
            {
                throw new ISO7816Exception(Error.ObjectNotFound);
            }
            return(key);
        }
Ejemplo n.º 2
0
 public SM(byte[] keys, IObjectWithSM owner,int numSM)
 {
     this.numSM = numSM;
     this.owner = owner;
     if (keys.Length > numSM)
         throw new ISO7816Exception(Error.DataFieldNotValid);
     foreach (byte b in keys)
         if (b == 0)
             throw new ISO7816Exception(Error.DataFieldNotValid);
     this.keys = keys;
 }
Ejemplo n.º 3
0
 public SM(byte allKeyEnc, byte allKeySig, IObjectWithSM owner, int numSM)
 {
     this.numSM = numSM;
     this.owner = owner;
     keys = new byte[numSM];
     for (int i = 0; i < numSM; i++)
     {
         if ((i%2)==0) 
             keys[i] = allKeyEnc;
         else
             keys[i] = allKeySig;
     }
 }
Ejemplo n.º 4
0
 public SM(byte allKeyEnc, byte allKeySig, IObjectWithSM owner, int numSM)
 {
     this.numSM = numSM;
     this.owner = owner;
     keys       = new byte[numSM];
     for (int i = 0; i < numSM; i++)
     {
         if ((i % 2) == 0)
         {
             keys[i] = allKeyEnc;
         }
         else
         {
             keys[i] = allKeySig;
         }
     }
 }
Ejemplo n.º 5
0
 public SM(byte[] keys, IObjectWithSM owner, int numSM)
 {
     this.numSM = numSM;
     this.owner = owner;
     if (keys.Length > numSM)
     {
         throw new ISO7816Exception(Error.DataFieldNotValid);
     }
     foreach (byte b in keys)
     {
         if (b == 0)
         {
             throw new ISO7816Exception(Error.DataFieldNotValid);
         }
     }
     this.keys = keys;
 }
Ejemplo n.º 6
0
        public virtual SM CreateSM(IObjectWithSM dest)
        {
            int numSM = 0;

            if (dest is BSO)
            {
                numSM = 16;
            }
            if (dest is DF)
            {
                numSM = 24;
            }
            if (dest is EF)
            {
                numSM = 24;
            }
            if (numSM == 0)
            {
                throw new Exception("Oggetto con SM non valido");
            }
            return(new SM(SM.NoSM, SM.NoSM, dest, numSM));
        }
Ejemplo n.º 7
0
 //public override string ToString()
 //{
 //    return "SM for " + (obj as ICardObject).Description;
 //}
 public WrapperBSOSM(IObjectWithSM obj)
 {
     this.obj = obj;
 }
Ejemplo n.º 8
0
 public BSO getSMKey(IObjectWithSM obj, byte SMcondition) {
     if (obj==null)
         return null;
     byte SMkey=SM.NoSM;
     if (obj.SM!=null)
         SMkey = obj.SM[SMcondition];
     if (SMkey==SM.NoSM)
         return null;
     var df=obj is DF ? (obj as DF) : (obj as ICardObject).Parent;
     var key = df.GetChildBSO(Util.ToUShort(BSOClass.SM, SMkey), true);
     if (key == null)
         throw new ISO7816Exception(Error.ObjectNotFound);
     return key;
 }