diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py index 3a4790a..f28ad18 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py @@ -50,7 +50,9 @@ class ControlReferenceTemplate: self.type = tag self.iv = None - self.keyref = None + self.keyref_secret_key = None + self.keyref_public_key = None + self.keyref_private_key = None self.key = None self.fileref = None self.DFref = None @@ -105,9 +107,11 @@ class ControlReferenceTemplate: self.fileref = value elif tag == 0x82: self.DFref = value - elif tag in (0x83, 0x84): - #Todo: Resolve reference - self.keyref = value + elif tag == 0x83: + self.keyref_secret_key = value + self.keyref_public_key = value + elif tag == 0x84: + self.keyref_private_key = value def __set_iv(self, tag, length, value): iv = None diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py b/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py index 33e9432..be35c66 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py @@ -39,22 +39,22 @@ class nPA_AT_CRT(ControlReferenceTemplate): self.chat = None def keyref_is_mrz(self): - if self.keyref == '%c'% self.PACE_MRZ: + if self.keyref_secret_key == '%c'% self.PACE_MRZ: return True return False def keyref_is_can(self): - if self.keyref == '%c'% self.PACE_CAN: + if self.keyref_secret_key == '%c'% self.PACE_CAN: return True return False def keyref_is_pin(self): - if self.keyref == '%c'% self.PACE_PIN: + if self.keyref_secret_key == '%c'% self.PACE_PIN: return True return False def keyref_is_puk(self): - if self.keyref == '%c'% self.PACE_PUK: + if self.keyref_secret_key == '%c'% self.PACE_PUK: return True return False @@ -355,7 +355,7 @@ class nPA_SE(Security_Environment): Authenticate the terminal to the card. Check whether Terminal correctly encrypted the given challenge or not """ - if self.dst.keyref: # TODO check if this is the correct CAR + if self.dst.keyref_public_key: # TODO check if this is the correct CAR id_picc = pace.EAC_Comp(self.eac_ctx, pace.EAC_ID_PACE, self.my_pace_eph_pubkey) # FIXME auxiliary_data might be from an older run of PACE