示例#1
0
        public override CommandApdu AsApdu()
        {
            this.P1 = (byte)this.scope;

            switch (this.scope)
            {
            case Scope.IssuerSecurityDomain:
                return(CommandApdu.Case1(ApduClass.GlobalPlatform, ApduInstruction.SetStatus, this.P1, this.P2));

            case Scope.SecurityDomain:
            case Scope.Application:
                return(CommandApdu.Case3S(ApduClass.GlobalPlatform, ApduInstruction.SetStatus, this.P1, this.P2, this.application));

            default:
                throw new NotSupportedException("Scope not supported.");
            }
        }
示例#2
0
        public override IEnumerable <CommandApdu> AsApdus()
        {
            var chunks = this.data.Split(this.blockSize).ToList();

            return(chunks.Select((block, index, isLast) =>
            {
                if (isLast)
                {
                    this.P1 ^= 0x80;
                }

                return CommandApdu.Case3S(
                    ApduClass.GlobalPlatform,
                    ApduInstruction.StoreData,
                    this.P1,
                    (byte)index,
                    block.ToArray());
            }));
        }
 public override CommandApdu AsApdu() => CommandApdu.Case3S(ApduClass.GlobalPlatform, ApduInstruction.ExternalAuthenticate, this.P1, this.P2, this.hostCryptogram);