public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            sigOut = null;
            encOut = null;

            BSO key = null;

            if (apdu.P1 == 0x80 && apdu.P2 == 0x86)
            {
                key = handler.GetEnvironmentKey(SecurityEnvironmentComponent.CON);
            }
            else if (apdu.P1 == 0x86 && apdu.P2 == 0x80)
            {
                key = handler.GetEnvironmentKey(SecurityEnvironmentComponent.CON);
            }
            else if (apdu.P1 == 0x9E && apdu.P2 == 0x9A)
            {
                key = handler.GetEnvironmentKey(SecurityEnvironmentComponent.CDS);
            }


            encIn  = handler.getSMKey(key, BSO_SM.SM_ENC_USE);
            sigIn  = handler.getSMKey(key, BSO_SM.SM_SIG_USE);
            encOut = handler.getSMKey(key, BSO_SM.SM_ENC_USE_OUT);
            sigOut = handler.getSMKey(key, BSO_SM.SM_SIG_USE_OUT);
        }
        public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            CardContext context = handler.Context;

            sigOut = null;
            encOut = null;

            ushort bsoId     = Util.ToUShort(apdu.P1, (byte)(apdu.P2 & 0x7f));
            bool   backTrack = (apdu.P2 & 0x80) != 0;
            BSO    bso       = null;

            if (backTrack)
            {
                bso = context.CurDF.GetChildBSO(bsoId, backTrack);
            }
            else
            {
                bso = context.CurDF.Owner.MasterFile.GetChildBSO(bsoId, false);
            }
            if (bso == null)
            {
                throw new ISO7816Exception(Error.FileNotFound);
            }

            encIn = handler.getSMKey(bso, BSO_SM.SM_ENC_CHANGE);
            sigIn = handler.getSMKey(bso, BSO_SM.SM_SIG_CHANGE);
        }
Example #3
0
        public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            var context = handler.Context;

            sigOut = null;
            encOut = null;

            encIn = handler.getSMKey(context.CurDF, DF_SM.SM_ENC_CREATE);
            sigIn = handler.getSMKey(context.CurDF, DF_SM.SM_SIG_CREATE);
        }
Example #4
0
        public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            CardContext context = handler.Context;

            sigIn  = null;
            encIn  = null;
            sigOut = null;
            encOut = null;

            var efBin = context.CurEF as EFBinary;

            if (efBin == null)
            {
                return;
            }

            encIn = handler.getSMKey(efBin, EF_SM.SM_ENC_UPDATE);
            sigIn = handler.getSMKey(efBin, EF_SM.SM_SIG_UPDATE);
        }
        public void PutDataSEKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            sigOut = null;
            encOut = null;

            if (context.CurDF == null)
            {
                throw new ISO7816Exception(Error.ClaNotValid);
            }

            encIn = handler.getSMKey(context.CurDF, DF_SM.SM_ENC_UPDATE_APPEND);
            sigIn = handler.getSMKey(context.CurDF, DF_SM.SM_SIG_UPDATE_APPEND);
        }
        public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            CardContext context = handler.Context;

            sigIn  = null;
            encIn  = null;
            sigOut = null;
            encOut = null;

            var efBin = context.CurEF as EFRecord;

            if (efBin == null)
            {
                return;
            }

            encIn = handler.getSMKey(efBin, EF_SM.SM_ENC_READ_IN);
            sigIn = handler.getSMKey(efBin, EF_SM.SM_SIG_READ_IN);

            encOut = handler.getSMKey(efBin, EF_SM.SM_ENC_READ_OUT);
            sigOut = handler.getSMKey(efBin, EF_SM.SM_SIG_READ_OUT);
        }
Example #7
0
        public void getSMKeys(Apdu apdu, out BSO sigIn, out BSO encIn, out BSO sigOut, out BSO encOut)
        {
            CardContext context = handler.Context;

            sigIn  = null;
            encIn  = null;
            sigOut = null;
            encOut = null;

            ushort pinId = (ushort)(apdu.P2 & 0x7f);
            BSO    pin   = null;

            if (pinId != 0)
            {
                bool backTrack = (apdu.P2 & 0x80) != 0;
                if (backTrack)
                {
                    pin = context.CurDF.GetChildBSO(pinId, backTrack);
                }
                else
                {
                    pin = context.CurDF.Owner.MasterFile.GetChildBSO(pinId, false);
                }
            }
            else
            {
                pin = handler.GetEnvironmentKey(SecurityEnvironmentComponent.TEST);
            }

            if (pin == null)
            {
                throw new ISO7816Exception(Error.FileNotFound);
            }

            encIn = handler.getSMKey(pin, BSO_SM.SM_ENC_USE);
            sigIn = handler.getSMKey(pin, BSO_SM.SM_SIG_USE);
        }