nPA: Skip RI, community and age verification

simply return 0x9000 saying "yes" to everything
This commit is contained in:
Frank Morgner
2012-09-14 15:09:31 +02:00
parent 8b3d802cab
commit fc0310359d
2 changed files with 14 additions and 0 deletions

View File

@@ -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()

View File

@@ -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"])