Ejemplo n.º 1
0
        public void Generate_protected_APDU2()
        {
            var kIfd    = new BinaryHex("0B795240CB7049B01C19B33E32804F0B"); //new CachedBinary(new Kifd()));
            var rndIc   = new FkRNDic();                                     //new CachedBinary(new RNDic(_reader));
            var rndIfd  = new FkRNDifd();                                    //new CachedBinary(new RNDifd());
            var kSeedIc = new KseedIc(
                kIfd,
                new Kic(
                    new R(
                        new BinaryHex("46B9342A41396CD7386BF5803104D7CEDC122B9132139BAF2EEDC94EE178534F2F2D235D074D7449"),                 //exterbalAuthData
                        new Symbols("L898902C<369080619406236")
                        )
                    )
                );

            Assert.AreEqual(
                "0CA4020C158709016375432908C044F68E08BF8B92D635FF24F800",
                new Hex(
                    new ProtectedCommandApdu(
                        new SelectEFCOMApplicationCommandApdu(),
                        new FkKSenc(),
                        new KSmac(kSeedIc),
                        new IncrementedSSC(new SSC(
                                               rndIc,
                                               rndIfd
                                               )).By(1)
                        )
                    ).ToString()
                );
        }
Ejemplo n.º 2
0
        public SessionKeys(
            ISymbols mrzInfo,
            IReader reader
            )
        {
            _selectedMrtdApplication = new Cached(
                new ExecutedCommandApdu(
                    new SelectMRTDApplicationCommandApdu(),
                    reader
                    )
                );

            var kIfd   = new Cached(new Kifd());
            var rndIc  = new Cached(new RNDic(reader));
            var rndIfd = new Cached(new RNDifd());
            var externalAuthRespData = new ResponseApduData(
                new Cached(
                    new ExecutedCommandApdu(
                        new ExternalAuthenticateCommandApdu(
                            new ExternalAuthenticateCommandData(
                                mrzInfo,
                                rndIc,
                                rndIfd,
                                kIfd
                                )
                            ),
                        reader
                        )
                    )
                );

            var kSeedIc = new KseedIc(
                kIfd,
                new Kic(
                    new R(
                        externalAuthRespData,
                        mrzInfo
                        )
                    )
                );

            _cachedKSenc = new Cached(new KSenc(kSeedIc));
            _cachedKSmac = new Cached(new KSmac(kSeedIc));
            _ssc         = new Cached(
                new SSC(
                    rndIc,
                    rndIfd
                    )
                );
        }