Beispiel #1
0
 def testthrowIt(self):
     try:
         ISOException.throwIt(ISO7816.SW_NO_ERROR)
         self.fail()
     except ISOException, isoe:
         self.assertEquals(0x9000,
                           isoe.getReason())
Beispiel #2
0
            def process(self, apdu):

                if self.selectingApplet():
                    return

                if apdu.isISOInterindustryCLA():
                    ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED)

                buffer = apdu.getBuffer()
                if buffer[ISO7816.OFFSET_INS] == self.CHOICE_1:
                    self.choice1(apdu)
                elif buffer[ISO7816.OFFSET_INS] == self.CHOICE_2:
                    self.choice2(apdu)
                elif buffer[ISO7816.OFFSET_INS] == self.CHOICE_3:
                    return
                else:
                    ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED)
Beispiel #3
0
    def process(self, apdu):
        if self.selectingApplet():
            return

        buf = apdu.getBuffer();

        if buf[ISO7816.OFFSET_CLA] != 0:
            ISOException.throwIt(framework.ISO7816.SW_CLA_NOT_SUPPORTED)

        if buf[ISO7816.OFFSET_INS] != 0xAA:
            ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED)

        try:
            action = {0x01: self.encryptRSA,
                      0x02: self.decryptRSA}
            action[buf[ISO7816.OFFSET_P1]](apdu)
            return
        except KeyError:
            ISOException.throwIt(ISO7816.SW_WRONG_P1P2)
Beispiel #4
0
 def process(self, apdu):
     ISOException.throwIt(ISO7816.SW_NO_ERROR)