Esempio n. 1
0
        public byte[] InitialAuthenticate(KeysetList keysets)
        {
            Iso7816Protocol protocol = Card.GetProtocol <Iso7816Protocol>();

            CApdu command = new CApdu();

            command.Cla  = CLA;
            command.Ins  = INS_PLAID_INITIAL_AUTH;
            command.P1   = 0x00;
            command.P2   = 0x00;
            command.Data = keysets.Encode();

            RApdu response = protocol.Transceive(command);

            // Validate the response,
            if (response.IsError)
            {
                throw response.ThrowBySW("InitialAuthenticate");
            }

            return(response.Data);
        }
Esempio n. 2
0
        /// <summary>
        /// This method performs the full PLAID authentication sequence, given a valid, selected PLAID SAM
        /// and a collection of keysets
        /// </summary>
        /// <param name="sam">The instance of a PLAID SAM</param>
        /// <param name="keysets">The collection of keyset identifiers to request</param>
        /// <param name="opMode">The requested opMode</param>
        /// <returns>The ACSRecord associated with the requested OpMode</returns>
        public byte[] Authenticate(IPlaidSAM sam, KeysetList keysets, short samId, short opMode)
        {
            // Initial Authenticate
#if PLAIDEXPLICITSELECT
            SelectApplication();
#endif
            byte[] estr1 = InitialAuthenticate(keysets);
#if PLAIDEXPLICITSELECT
            sam.SelectApplication(); // REMOVE
#endif
            byte[] estr2 = sam.InitialAuthenticate(samId, estr1, opMode);

            // Final Authenticate
#if PLAIDEXPLICITSELECT
            SelectApplication();
#endif
            byte[] estr3 = FinalAuthenticate(estr2);
#if PLAIDEXPLICITSELECT
            sam.SelectApplication(); // REMOVE
#endif

            return(sam.FinalAuthenticate(estr3));
        }