diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py index e045530..b4c8dd3 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/CardGenerator.py @@ -143,7 +143,9 @@ class CardGenerator(object): from virtualsmartcard.cards.nPA import nPA_SAM ALGO_MAPPING["\x04\x00\x7f\x00\x07\x02\x02\x04\x02\x02"] = "PACE" ALGO_MAPPING["\x04\x00\x7f\x00\x07\x02\x02\x03\x02\x02"] = "CA" + ALGO_MAPPING["\x04\x00\x7f\x00\x07\x03\x01\x04\x03"] = "CommunityID" ALGO_MAPPING["\x04\x00\x7f\x00\x07\x03\x01\x04\x02"] = "DateOfExpiry" + ALGO_MAPPING["\x04\x00\x7f\x00\x07\x03\x01\x04\x01"] = "DateOfBirth" self.mf = MF() diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py b/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py index 3717e1c..bf064af 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/cards/nPA.py @@ -141,6 +141,9 @@ class nPA_SE(Security_Environment): return self.__eac_pace_step4(data) elif self.eac_step == 5 and self.at.algorithm == "CA": return self.__eac_ca(data) + elif self.eac_step == 6: + # TODO implement RI + return SW["NORMAL"], "" raise SwError(SW["ERR_INCORRECTPARAMETERS"]) @@ -526,6 +529,15 @@ class nPA_SAM(SAM): for tag, length, value in structure: if tag == 6 and ALGO_MAPPING[value] == "DateOfExpiry": # hell yes, this is a valid nPA + # TODO actually check it... + return SW["NORMAL"], "" + if tag == 6 and ALGO_MAPPING[value] == "DateOfBirth": + # hell yes, we are old enough + # TODO actually check it... + return SW["NORMAL"], "" + if tag == 6 and ALGO_MAPPING[value] == "CommunityID": + # well OK, we are living there + # TODO actually check it... return SW["NORMAL"], "" raise SwError(SW["WARN_NOINFO63"])