FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
smartcard-interpreter.ApplicationGids Class Reference
Inheritance diagram for smartcard-interpreter.ApplicationGids:
Collaboration diagram for smartcard-interpreter.ApplicationGids:

Public Member Functions

 __init__ (self, aid)
 
 getAID (self)
 
 parseFcp (self, bytes)
 
 parseFci (self, bytes)
 
 selectResult (self, selectT, status, body)
 
 getData (self, fileId, bytes)
 
 getDataResult (self, status, body)
 
 mse (self, body)
 
 mseResult (self, status, body)
 
 getResponse (self, status, body)
 
 getResponseResult (self, status, body)
 
 pso (self, body)
 
 psoResult (self, status, body)
 

Data Fields

 aid
 
 lastDo
 

Detailed Description

GIDS application

Definition at line 406 of file smartcard-interpreter.py.

Constructor & Destructor Documentation

◆ __init__()

smartcard-interpreter.ApplicationGids.__init__ (   self,
  aid 
)

Definition at line 409 of file smartcard-interpreter.py.

409 def __init__(self, aid):
410 self.aid = aid
411 self.lastDo = None
412

Member Function Documentation

◆ getAID()

smartcard-interpreter.ApplicationGids.getAID (   self)

Definition at line 413 of file smartcard-interpreter.py.

413 def getAID(self):
414 return self.aid
415

◆ getData()

smartcard-interpreter.ApplicationGids.getData (   self,
  fileId,
  bytes 
)

Definition at line 506 of file smartcard-interpreter.py.

506 def getData(self, fileId, bytes):
507 lc = bytes[4]
508 tag = bytes[5]
509 tagLen = bytes[6]
510
511 if tag == 0x5c:
512 doStr = bytes[7:7+tagLen].hex()
513 ret = '\tDO=%s\n' % DOs.get(doStr, "<%s>" % doStr)
514 self.lastDo = doStr
515 else:
516 ret = '\tunknown tag=0%x len=%d v=%s' % (tag, tagLen, bytes[7:7+tagLen].hex())
517
518 return ret
519

◆ getDataResult()

smartcard-interpreter.ApplicationGids.getDataResult (   self,
  status,
  body 
)

Definition at line 520 of file smartcard-interpreter.py.

520 def getDataResult(self, status, body):
521 ret = ''
522 '''
523 while len(body) > 2:
524 tag = body[0]
525 tagLen = body[1]
526
527 ret += '\ttag=0x%x len=%d content=%s\n' % (tag, tagLen, body[2:2+tagLen].hex())
528
529 body = body[2+tagLen:]
530 '''
531 return ret
532

◆ getResponse()

smartcard-interpreter.ApplicationGids.getResponse (   self,
  status,
  body 
)

Definition at line 539 of file smartcard-interpreter.py.

539 def getResponse(self, status, body):
540 return body.hex()
541

◆ getResponseResult()

smartcard-interpreter.ApplicationGids.getResponseResult (   self,
  status,
  body 
)

Definition at line 542 of file smartcard-interpreter.py.

542 def getResponseResult(self, status, body):
543 return body.hex()
544

◆ mse()

smartcard-interpreter.ApplicationGids.mse (   self,
  body 
)

Definition at line 533 of file smartcard-interpreter.py.

533 def mse(self, body):
534 return body.hex()
535

◆ mseResult()

smartcard-interpreter.ApplicationGids.mseResult (   self,
  status,
  body 
)

Definition at line 536 of file smartcard-interpreter.py.

536 def mseResult(self, status, body):
537 return body.hex()
538

◆ parseFci()

smartcard-interpreter.ApplicationGids.parseFci (   self,
  bytes 
)

Definition at line 446 of file smartcard-interpreter.py.

446 def parseFci(self, bytes):
447 ret = ''
448 tag = bytes[0]
449 tagLen = bytes[1]
450
451 body = bytes[2:2+tagLen]
452
453 if tag == 0x61:
454 ret += '\tFCI\n'
455
456 while len(body) > 2:
457 tag2 = body[0]
458 tag2Len = body[1]
459 tag2Body = body[2:2+tag2Len]
460
461 if tag2 == 0x4F:
462 ret += '\t\tApplication AID: %s\n' % tag2Body.hex()
463
464 elif tag2 == 0x50:
465 ret += '\t\tApplication label: %s\n' % tag2Body.encode('utf8')
466
467 elif tag2 == 0x73:
468 body2 = tag2Body
469 tokens = []
470 while len(body2) > 2:
471 tag3 = body2[0]
472 tag3Len = body2[1]
473
474 if tag3 == 0x40:
475 v = body2[2]
476 if v & 0x80:
477 tokens.append('mutualAuthSymAlgo')
478 if v & 0x40:
479 tokens.append('extAuthSymAlgo')
480 if v & 0x20:
481 tokens.append('keyEstabIntAuthECC')
482
483
484 body2 = body2[2+tag3Len:]
485
486 ret += '\t\tDiscretionary data objects: %s\n' % ",".join(tokens)
487 else:
488 ret += '\t\tunhandled tag=0x%x body=%s\n' % (tag2, tag2Body.hex())
489
490 body = body[2+tag2Len:]
491
492 return ret
493
494

◆ parseFcp()

smartcard-interpreter.ApplicationGids.parseFcp (   self,
  bytes 
)

Definition at line 416 of file smartcard-interpreter.py.

416 def parseFcp(self, bytes):
417 ret = ''
418 tag = bytes[0]
419 tagLen = bytes[1]
420
421 body = bytes[2:2+tagLen]
422
423 if tag == 0x62:
424 ret += '\tFCP\n'
425
426 while len(body) > 2:
427 tag2 = body[0]
428 tag2Len = body[1]
429 tag2Body = body[2:2+tag2Len]
430
431 if tag2 == 0x82:
432 ret += '\t\tFileDescriptor: %s\n' % tag2Body.hex()
433 elif tag2 == 0x8a:
434 ret += '\t\tLifeCycleByte: %s\n' % tag2Body.hex()
435 elif tag2 == 0x84:
436 ret += '\t\tDF name: %s\n' % tag2Body.encode('utf8')
437 elif tag2 == 0x8C:
438 ret += '\t\tSecurityAttributes: %s\n' % tag2Body.hex()
439 else:
440 ret += '\t\tunhandled tag=0x%x body=%s\n' % (tag2, tag2Body.hex())
441
442 body = body[2+tag2Len:]
443
444 return ret
445

◆ pso()

smartcard-interpreter.ApplicationGids.pso (   self,
  body 
)

Definition at line 545 of file smartcard-interpreter.py.

545 def pso(self, body):
546 return body.hex()
547

◆ psoResult()

smartcard-interpreter.ApplicationGids.psoResult (   self,
  status,
  body 
)

Definition at line 548 of file smartcard-interpreter.py.

548 def psoResult(self, status, body):
549 return body.hex()
550
551
552

◆ selectResult()

smartcard-interpreter.ApplicationGids.selectResult (   self,
  selectT,
  status,
  body 
)

Definition at line 495 of file smartcard-interpreter.py.

495 def selectResult(self, selectT, status, body):
496 if not len(body):
497 return ''
498
499 if selectT == 'FCP':
500 return self.parseFcp(body)
501 elif selectT == 'FCI':
502 return self.parseFci(body)
503 else:
504 return '\tselectResult(fci=%s, status=0x%x) = %s\n' % (selectT, status, body.hex())
505

Field Documentation

◆ aid

smartcard-interpreter.ApplicationGids.aid

Definition at line 410 of file smartcard-interpreter.py.

◆ lastDo

smartcard-interpreter.ApplicationGids.lastDo

Definition at line 411 of file smartcard-interpreter.py.


The documentation for this class was generated from the following file: