Exemple #1
0
 def testgetBytes(self):
     a1 = AID([0xA0, 0x00, 0x00, 0x00, 0x62, 0x03, 0x04, 0x00], 0, 8)
     dest = [0 for i in range(100)]
     self.assertEquals(a1.getBytes(dest, 5), 8)
     self.assertEquals(dest[5:5+8], a1.aid)
     dest = []
     try:
         self.assertEquals(a1.getBytes(dest, 5), 8)
         self.fail()
     except ArrayIndexOutOfBoundsException:
         pass
Exemple #2
0
 def testEquals(self):
     a1 = AID([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 0, 8)
     self.assertTrue(a1.equals([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 1, 8))
     self.assertFalse(a1.equals([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 1, 7))
     self.assertFalse(a1.equals([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 0, 8))
     
     try:
         a1.equals([7, 8, 9, 10, 11, 12, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x61, 0x62], 6, 8)
         self.fail()
     except ArrayIndexOutOfBoundsException:
         pass
Exemple #3
0
 def mylookupAID(buffer, offset, length):
     if a2d(buffer[offset:offset + length]) in self.applets:
         return AID(buffer, offset, length)
     return None
Exemple #4
0
 def mygetAID():
     return AID(self.current_applet_aid, 0, len(self.current_applet_aid))