Ejemplo n.º 1
0
        public override IEnumerable <CommandApdu> AsApdus()
        {
            var commandData = new List <byte>();

            if (this.securityDomainAID.Any())
            {
                var dapBlock = TLV.Build((byte)Tag.DapBlock,
                                         TLV.Build((byte)Tag.SecurityDomainAID, this.securityDomainAID),
                                         TLV.Build((byte)Tag.LoadFileDataBlockSignature, this.signature)
                                         );

                commandData.AddTLV(dapBlock);
            }

            commandData.AddTLV(TLV.Build((byte)Tag.LoadFileDataBlock, this.data));

            var chunks = commandData.Split(this.blockSize).ToList();

            return(chunks.Select((block, index, isLast) => CommandApdu.Case4S(
                                     ApduClass.GlobalPlatform,
                                     ApduInstruction.Load,
                                     (byte)(isLast ? 0x80 : 0x00),
                                     (byte)index,
                                     block.ToArray(),
                                     0x00)));
        }
Ejemplo n.º 2
0
 private new CommandApdu Build(IEnumerable <byte> commandData, byte p2 = 0x00)
 {
     return(CommandApdu.Case4S(ApduClass.GlobalPlatform, ApduInstruction.Install, this.P1, p2, commandData.ToArray(), 0x00));
 }
Ejemplo n.º 3
0
 public override CommandApdu AsApdu() => CommandApdu.Case4S(ApduClass.GlobalPlatform, ApduInstruction.InitializeUpdate, this.P1, this.P2, this.hostChallenge, 0x00);
Ejemplo n.º 4
0
 public override CommandApdu AsApdu() => CommandApdu.Case4S(ApduClass.Iso7816, ApduInstruction.Select, 0x04, this.P2, this.application, 0x00);
Ejemplo n.º 5
0
 public override CommandApdu AsApdu()
 => CommandApdu.Case4S(ApduClass.GlobalPlatform, ApduInstruction.GetData, this.P1, this.P2, this.tagList, 0x00);