예제 #1
0
        public byte[] Bytes()
        {
            // DO87 Format: [87][EncryptedDataLength + 1][01][EncryptedData]
            var berTlvVal = new CombinedBinaries(
                _berTlvValFirstByte,
                _encryptedData
                );
            var berTlvLen = new HexInt(
                new BytesCount(berTlvVal)
                );

            return(new CombinedBinaries(
                       _berTlvTag,
                       berTlvLen,
                       berTlvVal
                       ).Bytes());
        }
예제 #2
0
파일: Padded.cs 프로젝트: tdav/MRTD.NET
        public byte[] Bytes()
        {
            var dataWithPaddedSingleBit = new CombinedBinaries(
                _data,
                new Binary(new [] { _singleBitWithLackingZeroBytes })
                );

            var paddedDataLengthInBytes = dataWithPaddedSingleBit
                                          .Bytes()
                                          .Count();
            var lackingBytesCount = _blockSize - (paddedDataLengthInBytes % 8);
            var lackingBytes      = Enumerable
                                    .Range(0, lackingBytesCount)
                                    .Select(i => (byte)0x00);

            return(new CombinedBinaries(
                       dataWithPaddedSingleBit,
                       new Binary(lackingBytes)
                       ).Bytes());
        }
        public byte[] Bytes()
        {
            var commandData = new CombinedBinaries(
                _do87,
                _do97,
                _do8e
                );

            var commandDataLengthAsBinaryHex = new HexInt(
                commandData
                .Bytes()
                .Count()
                );

            return(new CombinedBinaries(
                       _maskedCommandApduHeader,
                       commandDataLengthAsBinaryHex,
                       commandData,
                       new Binary(_exceptedDataLength)
                       ).Bytes());
        }